Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sqlsrv drivers doesn't appear on a WAMP server phphinfo() after adding the extension entries in the php.ini file

I wanted to setup a database connection from PHP to SQL server 2012.I have a wamp server(64 bit) set up on a windows machine(64 bit) with PHP 5.5.12 and on the same machine I have SQL server 2012 installed.

Extracted sqlsrv drivers from official_link

Copied the extracted drivers php_sqlsrv_55_ts.dll, extension = php_pdo_sqlsrv_55_ts.dll to php\ext folder, and then changed the php.ini file to include the extensions

extension = php_sqlsrv_55_ts.dll; extension = php_pdo_sqlsrv_55_ts.dll;

Now I tried

<?php
  phpinfo();
 ?>

I see the following information without any SQL server information in it.

enter image description here

enter image description here

Don't seem to have configured SQL server connection successfully. Could some one please guide me on what I am missing here.

like image 863
user2569524 Avatar asked Nov 19 '14 03:11

user2569524


2 Answers

64 bit WAMP server was not able to connect using the drivers extension = php_sqlsrv_55_ts.dll; extension = php_pdo_sqlsrv_55_ts.dll;

So, I installed a 32 bit version of the WAMP server and it works fine now.

like image 191
user2569524 Avatar answered Nov 20 '22 09:11

user2569524


Check the php error log (c:\wamp\logs\php_error.log). I had the same setup (64bit WAMP/PHP 5.5.12) and same missing sqlsrv reference in phpinfo and I got this error in my log:

PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.5.12/ext/php_pdo_sqlsrv_55_ts.dll' - %1 is not a valid Win32 application. in Unknown on line 0

The solution was to install the 64bit version of the sqlsrv drivers. I found the unofficial 64bit drivers through http://robsphp.blogspot.nl/2012/06/unofficial-microsoft-sql-server-driver.html

Warning: In my testing I found these 64bit PHP_PDO_SQLSRV extension 10 times slower than when using PHP_PDO_ODBC.

like image 3
Jan Avatar answered Nov 20 '22 09:11

Jan