I have come across quite a few post regarding the same subject question, however I am still unable to resolve it and so I ask. I am trying to connect to sql in my php script. My connection string is:
/* Specify the server and connection string attributes. */
$serverName = "xxx-PC\SQLExpress";
$connectionOptions = array("Database"=>"Salesforce");
$conn = sqlsrv_connect($serverName, $connectionOptions);
if($conn === false)
{
      die(print_r(sqlsrv_errors(), true));
}
I have installed and included the following in my php.ini file located under the wamp folder: C:\wamp\bin\php\php5.4.16:
extension=c:/wamp/bin/php/php5.4.16/ext/php_sqlsrv_53_ts.dll
My wampserver is running fine and so are the wampapache and wampsqld services. I am able to execute php.exe successfully. However I am unable to make the connection to SQL Server 2008 R2 where my database is located. Please help!
EDIT 1: The wamp server is running the wampmysql service while I am trying to connect to SQL Server 2008 R2. Could this be the reason? Should I be using MySQL instead of SQL? Any pointers?
EDIT 2: I do not see sqlsrv section at all when I run phpinfo() though I have added extension=php_sqlsrv_54_ts.dll in the php.ini file located in the bin folder of the wamp server. 

When you install third-party extensions you need to make sure that all the compilation parameters match:
Common glitches includes:
php.ini file (that's typical with bundles); the right path is shown in phpinfo().Not being able to see the startup errors; those should show up in Apache logs, but you can also use the command line to diagnose it, e.g.:
php -d display_startup_errors=1 -d error_reporting=-1 -d display_errors -c "C:\Path\To\php.ini" -m  If everything's right you should see sqlsrv in the command output and/or phpinfo() (depending on what SAPI you're configuring):
[PHP Modules]
bcmath
calendar
Core
[...]
SPL
sqlsrv
standard
[...]

This helped me get to my answer. There are two php.ini files located, in my case, for wamp. One is under the php folder and the other one is in the C:\wamp\bin\apache\Apachex.x.x\bin folder. When connecting to SQL through sqlsrv_connect function, we are referring to the php.ini file in the apache folder. Add the following (as per your version) to this file:
extension=c:/wamp/bin/php/php5.4.16/ext/php_sqlsrv_53_ts.dll
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With