[英]How to install an SQLSRV extension to php XAMPP
I'm trying to install a SQLSRV extension. 我正在尝试安装SQLSRV扩展。 My PHP version is 7.2 (XAMPP 3.2.2) and I use windows 10. I downloaded the .dll from here: https://github.com/Microsoft/msphpsql/releases .
我的PHP版本是7.2(XAMPP 3.2.2),我使用Windows10。我从此处下载了.dll: https : //github.com/Microsoft/msphpsql/releases 。 Then I unpacked it to the
xampp/php/ext
folder 然后我将其解压缩到
xampp/php/ext
文件夹中
After that I opened the php.ini
and added this extension: 之后,我打开了
php.ini
并添加了此扩展名:
Next I restarted the Apache server. 接下来,我重新启动了Apache服务器。
Unfortunately when I open the phpinfo website I don't see the extension. 不幸的是,当我打开phpinfo网站时,没有看到扩展名。 Also when I open the XAMPP shell and type php I'm getting an error.
另外,当我打开XAMPP shell并键入php时 ,出现错误。
PHP Startup: Unable to load dynamic library 'php_pdo_sqlsrv_72_nts' (tried: C:\\xampp\\php\\ext\\php_pdo_sqlsrv_72_nts (Module was not found.)
PHP启动:无法加载动态库“ php_pdo_sqlsrv_72_nts”(尝试:C:\\ xampp \\ php \\ ext \\ php_pdo_sqlsrv_72_nts(未找到模块。)
My extension_dir in php.ini is set to extension_dir="C:\\xampp\\php\\ext"
. 我在php.ini中的
extension_dir="C:\\xampp\\php\\ext"
设置为extension_dir="C:\\xampp\\php\\ext"
。
Architecture is x86. 架构是x86。
What did I do wrong? 我做错了什么?
EDIT: I've changed the nts to ts files and now its working. 编辑:我已经将nts更改为ts文件,现在可以正常工作了。
Remove the 删除
php_
PHP_
prefix from your php.ini file. php.ini文件中的前缀。 because php automatically searching with the name of file with the prefix: php_pdo_sqlsrv_72_ts_x86.dll Example: if you register the dll file as:
因为php自动使用前缀为php_pdo_sqlsrv_72_ts_x86.dll的文件名进行搜索,例如:如果您将dll文件注册为:
pdo_sqlsrv_72_ts_x86
pdo_sqlsrv_72_ts_x86
then php will search the dll file as: 然后php将搜索dll文件为:
php_php_pdo_sqlsrv_72_ts_x86.dll
php_php_pdo_sqlsrv_72_ts_x86.dll
worked for me by telling in the PHP.ini file in this way: 通过以这种方式告诉PHP.ini文件为我工作:
extension=mysql
extension=sqlsrv
extension=pdo_sqlsrv
so, you have to remove "php_" and ".dll" 因此,您必须删除“ php_”和“ .dll”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.