I know that this question has already been asked several times on this website but I\'m seriously starting to wonder wheter I\'m crazy or not.
My configuration : Wam
Installing just the PHP extension is not enough, you also need to install Microsoft® ODBC Driver 11 for SQL Server® - Windows
The ODBC drivers can be found here
And newer drivers can be found here
Also the best way to ensure you are editing the correct php.ini
file is to use the wampmanager menus. So in future do :-
wampmanager -> PHP -> php.ini
This will load the correct php.ini into yoru editor.
C:\wamp\bin\php\php{version}\php.ini
is used only by PHP CLI
C:\wamp\bin\apache\apache{version}\bin\php.ini
is used only by PHP when running under Apache
Detailed steps for SQL Server Lovers to Install and Configure PhP:
Configure PhP a. Update conf file Thumbrules are i. Change Port ii. Change from Deny to Granted iii. Change from None to Allow iii. Change the order from Deny, Allow to Allow, Deny
C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf
Line # 62, 63
Listen 127.0.0.1:8201
Listen [::0]:8201
Line # 240
<Directory />
AllowOverride all
#Require all granted
Order allow,deny
Allow from all
</Directory>
Line #274
AllowOverride all
Line #282
Order allow,deny
Allow from all
Line #299
Require all granted
b. If Wamp is running, exit and restart c. type http://localhost:8201/ in browser, to get wamp home page d. place any sample html page in c:\wamp\www folder http://localhost:8201/pagename.html
SQL Server Configuration Current Configuration WampServer 2.5 32bits [64 bits success story for SQL Server is less] PHP 5.5.12 Apache 2.4.9
Steps:
a. Download Microsoft Driver SQLSRV32.exe from https://www.microsoft.com/en-us/download/details.aspx?id=20098.
b. Extract the files from the .exe downloaded on my temp folder
c. Copy php_sqlsrv_55_ts.dll and php_pdo_sqlsrv_55_ts.dll into C:\wamp\bin\php\php5.5.12\ext folder
d. Or Copy dlls from DLL folder to C:\wamp\bin\php\php5.5.12\ext folder
e. Edit C:\wamp\bin\php\php5.5.12\php.ini add
extension=php_pdo_sqlsrv_55_ts.dll
extension=php_sqlsrv_55_ts.dll
f. Edit C:\wamp\bin\apache\apache2.4.9\bin\php.ini add
extension=php_pdo_sqlsrv_55_ts.dll
extension=php_sqlsrv_55_ts.dll
g. Install Microsoft® ODBC Driver 11 64 bit or 32 bit as per your OS. My OS is 64 bit. The ODBC drivers can be found @ https://www.microsoft.com/en-us/download/details.aspx?id=36434 or in the folder ODBC
And newer drivers can be found @ https://www.microsoft.com/en-us/download/details.aspx?id=20098
e. Restart all services / Restart computer
f. Place Sample php files in c:\wamp\www\TestWeb folder and browse http://localhost:8201/TestWeb/page.php
g. Change host name, db name, uid and pwd as per your SQL server credentials
I finally found what was causing the problem. My Wamp was in 64 bits but the sqlsrv driver only works with 32 bits version. Now it works perfectly.
Did you try to modify php.ini using the wamp interface ?
I know it sounds strange but sometimes the result is different than editing directly the file using the browser. Wamp manages those files in a strange way, give it a try...