Jump to content

PHP shows the sqlsrv drivers, but I can't connect to MS-SQL


Recommended Posts



I managed to install PHP and Apache on a virtual machine at home (host runs Windows 2008 Server). I'm half way testing there but I need to start working on my work's laptop now (for presentation, official stuff, etc)


So I installed XAMPP. I downloaded the MS-SQL drivers from this URL: http://msdn.microsoft.com/library/cc296170.aspx


I edited PHP ini adding this line:




And also dropped the php_sqlsrv_53_ts_vc9.dll file into the "ext" folder that goes under xampp


I restarted Apache and I can see PHP shows the sqlsrv drivers section, so should work ok, but I can't connect to MS-SQL. I can't even run a simple PHP script like this:



$serverName = "servername";
$connectionOptions = array("Database"=>"AdventureWorks");
$conn = sqlsrv_connect( $serverName, $connectionOptions);
if( $conn === false )
die( FormatErrors( sqlsrv_errors() ) );


It fails miserably with following error: Fatal error: Call to undefined function FormatErrors() in C:\xampp\htdocs\project\connectivity.php on line 6


Am I missing something? By the way, my work's laptop runs Windows Vista. Not sure if that can be a problem. I am running most recent SQL client drivers I think.

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.