1
votes

I am running PHP 5.6.21 under IIS on Windows Server 2012R2. PHP is working great.

I need PHP to connect to a Microsoft SQL database, so I have this line uncommented in php.ini: extension=php_mssql.dll

Yes, I have that file in the ext folder, and the correct folder is listed for extensions in the php.ini file.

I also have SQL Native client installed, the ODBC drivers, and the PHP SQL drivers.

When I go to connect to a SQL database, I get: Fatal error: Call to undefined function mssql_connect() in....

This EXACT code is working on an older 2003 server.

If I look at the phpinfo on the new server, this is in the "configure command" area:

cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-enchant=shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--without-analyzer" "--with-pgo"

That looks strange - it has "without-mssql" listed there...is this what is preventing mssql from working? Since I have the extension loading in the php.ini file, I don't know where else to look...

Any help GREATLY appreciated - this is driving me nuts. Thanks!

PS - I realize I can replace mssql_connect with sqlsrv_connect, but there is a lot of code that would need updating - I'm trying to avoid that since this code works on an older server.

1
That means exactly what it says, that it was compiled without support for mssql - miken32
Miken - sorry, I guess I just don't understand - is that what is preventing it from working even though I have the extension enabled in the php.ini? I saw that other post, but I'm still not able to get this working. - ShorePatrol
From the accepted answer: "To connect PHP with SQL Server you need Microsoft Drivers for PHP for SQL Server" - miken32

1 Answers

0
votes

Miken - as in my original post, I have installed the PHP/SQL drivers.

Actually, the issue is the MSSQL extensions are no longer available past PHP 5.3.

So it looks like I have to update the code to use sqlsrv_connect.

In any case, thanks for the replies.