[unixODBC][Driver Manager]Can't open lib '/usr/local/lib/libmsodbcsql.17.dylib' : file not found
开发环境:
- xampp
- PHP Version 7.3.26
- Microsoft PHP驱动程序 5.8 sqlsrv/pdo_sqlsrv
- SQL Server 2014
- macOS High Sierra
可以找得到 /usr/local/lib/libmsodbcsql.17.dylib ,权限也改为777了
$ ls -l /usr/local/lib/libmsodbcsql.17.dylib
lrwxr-xr-x 1 daemon daemon 56 2 20 11:43 /usr/local/lib/libmsodbcsql.17.dylib -> ../Cellar/msodbcsql17/17.7.1.1/lib/libmsodbcsql.17.dylib
在命令行里使用
sqlcmd -S <server> -U <uid> -P <pwd>
或者
isql -v -k "Driver=ODBC Driver 17 for SQL Server;Server=<server>;UID=<uid>;PWD=<pwd>"
都可以连接到mssql,就是在项目中php中
$data = sqlsrv_connect('server_ip', array('Database' => 'DB_name', 'UID' => 'uid' , 'PWD' => 'pwd')); var_dump(sqlsrv_errors());
搞不清楚什么原因?