sql-lover Posted February 4, 2012 Share Posted February 4, 2012 Ok, 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: extension=php_sqlsrv_53_ts_vc9.dll 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: <?php $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. Quote Link to comment https://forums.phpfreaks.com/topic/256358-php-shows-the-sqlsrv-drivers-but-i-cant-connect-to-ms-sql/ Share on other sites More sharing options...
kicken Posted February 4, 2012 Share Posted February 4, 2012 FormatErrors is not any standard function. Not sure where you got that name from. To see what the error is, try var_dump(sqlsrv_errors()); Quote Link to comment https://forums.phpfreaks.com/topic/256358-php-shows-the-sqlsrv-drivers-but-i-cant-connect-to-ms-sql/#findComment-1314268 Share on other sites More sharing options...
sql-lover Posted February 4, 2012 Author Share Posted February 4, 2012 FormatErrors is not any standard function. Not sure where you got that name from. To see what the error is, try var_dump(sqlsrv_errors()); Thanks for reply. I will check at home, but I'm almost sure the code there works! and uses that function. Quote Link to comment https://forums.phpfreaks.com/topic/256358-php-shows-the-sqlsrv-drivers-but-i-cant-connect-to-ms-sql/#findComment-1314280 Share on other sites More sharing options...
sql-lover Posted February 5, 2012 Author Share Posted February 5, 2012 FormatErrors was a function, wrote on a separate file missing here. In other words, you were right. And because the file was missing, I was getting that silly error! Thanks for pointing that out! Quote Link to comment https://forums.phpfreaks.com/topic/256358-php-shows-the-sqlsrv-drivers-but-i-cant-connect-to-ms-sql/#findComment-1314813 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.