Sqlsrv for PHP 5.6 on WAMP server

Danishdjinn picture Danishdjinn · Apr 7, 2016 · Viewed 27k times · Source

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:

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:

  • 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.

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: Extension showed up here

Any ideas to what I did wrong or why it don't show up in phpinfo()?

Answer

Danishdjinn picture Danishdjinn · Apr 8, 2016

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.

Official Microsoft SQL Server Driver for PHP: Here 32 bit - use this if you have a 32bit wampserver.

Unofficial Microsoft SQL Server Driver for PHP: Here 64 bit - use this if you have a 64bit server.

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.