操作系统:Windows 8.1
Web服务器:WAMPSERVER 3.0.6
PHP版:5.6.25
目标:使用PHP建立MYSQL数据库连接
做了什么:
SQLSRV
驱动程序(SQLSRV32.EXE
)php_pdo_sqlsrv_56_ts.dll
和php_sqlsrv_56_ts.dll
复制到目录"C:\wamp64\bin\php\php5.6.25\ext"
extension_dir = "c:/wamp64/bin/php/php5.6.25/ext/"
将以下行添加到php.ini
文件中的动态扩展部分:
extension=php_pdo_sqlsrv_56_ts.dll
extension=php_sqlsrv_56_ts.dll
重新启动的Web服务器
但是:phpinfo()
sqlsrv()
代码:
$myServer = "(local)";
$myUser = "sa";
$myPass = "pass";
$myDB = "example_db";
$connectionInfo = array("Database"=>$myDB, "UID" => $myUser, "PWD" => $myPass);
$conn = sqlsrv_connect($myServer, $connectionInfo);
错误:
Fatal error: Call to undefined function sqlsrv_connect() in
C:\wamp64\www\optimum_p\common\dbconnect.php on line 6