Sqlsrv for PHP 5.6 on WAMP server
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36472648/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Sqlsrv for PHP 5.6 on WAMP server
提问by Danishdjinn
After looking so many posts about this problem, I don't understand why it don't work because it should be working. I will post all the information I have so far:
After looking so many posts about this problem, I don't understand why it don't work because it should be working. I will post all the information I have so far:
Windows 10 64-bit
WampServer 3 64-bit (http://www.wampserver.com/)
PHP 5.6.16
Apache 2.4.17
- Microsoft SQL Server 2016
Windows 10 64-bit
WampServer 3 64-bit (http://www.wampserver.com/)
PHP 5.6.16
Apache 2.4.17
- Microsoft SQL Server 2016
I downloaded SQLSRV32.exe from microsoft. I extracted the dll files to C:\wamp\bin\php\php5.6.16\ext.
I downloaded SQLSRV32.exe from microsoft. I extracted the dll files to C:\wamp\bin\php\php5.6.16\ext.
In my php.ini given by wampserver:
In my php.ini given by wampserver:
extension_dir = "c:/wamp/bin/php/php5.6.16/ext/"
extension=php_sqlsrv_56_ts.dll
extension=php_pdo_sqlsrv_56_ts.dll
extension_dir = "c:/wamp/bin/php/php5.6.16/ext/"
extension=php_sqlsrv_56_ts.dll
extension=php_pdo_sqlsrv_56_ts.dll
I have php5ts.dll in my php5.6.16 folder, so I think I have thread safe which is why I am using ts.dll ones.
I have php5ts.dll in my php5.6.16 folder, so I think I have thread safe which is why I am using ts.dll ones.
If I'm in phpinfo() I should see a 'sqlsrv' section in there, but I don't see one, so I guess I did something wrong here somewhere?
If I'm in phpinfo() I should see a 'sqlsrv' section in there, but I don't see one, so I guess I did something wrong here somewhere?
I even did restart on wampserver many times and run as an administrator. It still don't show up on phpinfo()... But I can see this in php extension at the Wampserver:
I even did restart on wampserver many times and run as an administrator. It still don't show up on phpinfo()... But I can see this in php extension at the Wampserver:
Any ideas to what I did wrong or why it don't show up in phpinfo()?
Any ideas to what I did wrong or why it don't show up in phpinfo()?
回答by Danishdjinn
I have found what was the problem.
I have found what was the problem.
It seems that I was using microsoft 32-bit sqlsrv driver, which don't work with wampserver 3 64-bit.
It seems that I was using microsoft 32-bit sqlsrv driver, which don't work with wampserver 3 64-bit.
Official Microsoft SQL Server Driver for PHP: Here32 bit - use this if you have a 32bit wampserver.
Official Microsoft SQL Server Driver for PHP: Here32 bit - use this if you have a 32bit wampserver.
Unofficial Microsoft SQL Server Driver for PHP: Here64 bit - use this if you have a 64bit server.
Unofficial Microsoft SQL Server Driver for PHP: Here64 bit - use this if you have a 64bit server.
After using the unofficial version, it showed up on phpinfo()!
After using the unofficial version, it showed up on phpinfo()!
Anyway, I hope this answer is useful to people who have spend looking around for an answer in hours... or whatever, I hope it was useful.
Anyway, I hope this answer is useful to people who have spend looking around for an answer in hours... or whatever, I hope it was useful.