Jump to content

Recommended Posts

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
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.