I was 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 did install it and included the below code in to my php.ini file which is 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 wamp server has been running fine and so are the wampapache and wampsqld services. I am able to execute php.exe successfully. However, I was unable to make the connection to the SQL Server 2008 R2 where my database has been located. Please help!
EDIT 1: The wamp server has been running the wampmysql service while I am trying connection to SQL Server 2008 R2. Could this be the reason? Should I use the MySQL instead of the 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, which is the bin folder of the wamp server.