Page 1 of 1

Call to undefined function mssql_connect()

PostPosted: 30. May 2013 14:52
by bazianm
Hi,

I am trying to get XAMPP 1.8.1 to work with SQL Server 2012. I can't seem to get it to to work.

I have googled the problem and based on that I did the following:

(My XAMPP is installed in f:\xampp)

I edited f:\xampp\php\php.ini and uncommented:
extension=php_mssql.dll

I copied the file ntwdblib.dll (File version 2000.2.8.0) to the following folders:
f:\xampp\apache\bin
f:\xampp\php

I downloaded php_mssql.dll and put it in f:\xampp\php\ext

I restarted the Apache service.

I still get an error:

Fatal error: Call to undefined function mssql_connect() in F:\xampp\htdocs\mydomain\functions.php on line 14

I checked my phpinfo. There is no MSSQL section. MSSQL is only mentioned under COnfigure Command:

cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" "--with-pgo"

I checked and the loaded configuration file is the one I edited.

Any assistance would be greatly appreciated.

Re: Call to undefined function mssql_connect()

PostPosted: 30. May 2013 22:17
by hackattack142
Hello,

You will most likely need to use the SQLSRV extension rather than the MSSQL one (they are both for MS SQL Server but MSSQL extension was discontinued some time ago and removed from PHP 5.3 and onward http://us2.php.net/manual/en/intro.mssql.php)

See here: http://www.php.net/manual/en/sqlsrv.requirements.php

1. You will need to grab the Microsoft SQL Server 2012 Native Client x86 install and the SQLSRV 3.0 install from the sqlsrv link above.
2. Extract the SQLSRV to somewhere convenient and copy the "php_sqlsrv_54_ts.dll" and "php_pdo_sqlsrv_54_ts.dll" files to your xampp/php/ext folder
3. Add the proper extension lines to your php.ini "extension=php_sqlsrv_54_ts.dll" and "extension=php_pdo_sqlsrv_54_ts.dll"
4. Restart apache and you should be good to go.

Note: if you have existing code that uses the mssql functions, you will need to port it to the sqlsrv ones.

Re: Call to undefined function mssql_connect()

PostPosted: 30. May 2013 22:27
by bazianm
Thanks. I will try that.

Re: Call to undefined function mssql_connect()

PostPosted: 12. June 2013 07:28
by pio_sk
Hi
I got similar problem.
Cant connect to MSsql server 2008 R2.
I added extension php_sqlsrv_54_ts.dll to my php and restarted server but now I got error :
"-49 [2] => This extension requires the Microsoft SQL Server 2012 Native Client. Access the following URL to download the Microsoft SQL Server 2012 Native Client ODBC driver for x86: ""

i tried to install that odbc driver but it is not supported for windows XP.
any clues how can I resolve this ?

Re: Call to undefined function mssql_connect()

PostPosted: 12. June 2013 11:27
by Nobbie
pio_sk wrote:i tried to install that odbc driver but it is not supported for windows XP.
any clues how can I resolve this ?


You should ask Microsoft.

Re: Call to undefined function mssql_connect()

PostPosted: 12. June 2013 23:21
by hackattack142