sqlsrv drivers doesn't appear on a WAMP server phphinfo() after adding the extension entries in the php.ini file
Solution 1
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.
Solution 2
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.
user2569524
Updated on July 24, 2022Comments
-
user2569524 almost 2 years
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
tophp\ext
folder, and then changed the php.ini file to include the extensionsextension = 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.
Don't seem to have configured SQL server connection successfully. Could some one please guide me on what I am missing here.
-
Funk Forty Niner over 9 yearsDid you restart all services and maybe even rebooted after making the changes? If not, do.
-
user2569524 over 9 yearsYes I restarted all the services.
-
RiggsFolly over 9 yearsHave you also download and installed the
Microsoft SQL Server 2012 Native Client
andMicrosoft ODBC Driver 11
. Remember the php extensions do not talk directly to the database, they talk to the Native Client. See theSystem Requirements
section on the download page you reference above. -
user2569524 over 9 years@RiggsFolly I have complete SQL server installed on the same machine, so I already have 'Microsoft SQL Server 2012 Native Client' installed by default that came with sql server installation. I checked ODBC administrator to confirm.
-
Franklin P Strube over 9 yearsCan you try executing the php.exe from a command prompt. It may give you additional error output that you cannot see on the web.
-
UnskilledFreak over 9 yearssorry if im wrong (i dont use mssql) but is this an simple extension or a zend extension?
-
risyasin over 9 yearsYou have to compile php from source. with "--with-mssql" option. since pecl does not support any pdo/mssql/sybase extension on windows. windows.php.net/downloads/pecl/releases
-
KTYP over 9 yearstry non thread safe version of sql driver for php. also if you can try 32bit version of wamp with sql server driver i had a terrible experience with 64bit wamp and mssql ;)
-
Pouya Darabi over 9 yearsclear wamp's logs , and restart wamp, read log , it's must contain a error ,that explain why dll not loaded!
-