0
votes

I am quite new to setting php with ms sql server.

I downloaded the php version php-5.6.31-nts-Win32-VC11-x86 and downloaded the drivers for ms sql db to the ext folder in the php path.

I can see the files php_sqlsrv_56_nts.dll and php_sqlsrv_56_ts.dll

I have also modified the php.ini file to extention=php_sqlsrv_56_nts.dll and extension_dir ="ext"

I have some php files in path1

I opened the command prompt in the php folder and executed the following command: php -S localhost:8085 -t path1

The server is setup succesfully. However, I get an error Fatal error:

Call to undefined function sqlsrv_connect() in the line

$conn = sqlsrv_connect($servername, $connectionInfo);

Did I miss anything here?

1
check phpinfo() and make sure it's in there - delboy1978uk
When viewing the output from phpinfo(), also check near the top to see the actual path of the php.ini it used. There may be multiple ini files used in different contexts, such as CLI vs web. I'm not sure on Windows if there's an .ini that might take precedence when using the php -S server. - Michael Berkowski
It points to the correct ini file. How do I understand whether the extensions have been loaded correctly or not from the phpinfo.php page? - Ajmal Moideen
phpinfo() says it is pointing to the correct ini file. - Ajmal Moideen

1 Answers

0
votes

I understood my error. I added both the dll files in php.ini and this worked extention=php_pdo_sqlsrv_56_nts.dll extension=php_sqlsrv_56_nts.dll;