1

I use the following code for connecting php with MS SQL :

$server = 'a.b.c.d';
$link = mssql_connect($server, 'sql_user', 'sql_user_pass');

But it gives the following error:

Fatal error: Call to undefined function mssql_connect()

How can I solve this?

Mention that I am using MS SQL (SQL SERVER 2008), PHP 5.3.1, WINDOWS 7.

hakre
  • 193,403
  • 52
  • 435
  • 836
Ariful Islam
  • 7,639
  • 7
  • 36
  • 54

2 Answers2

2

“mssql” was dropped from PHP 5.3 distribution. Use sqlsrv drivers instead. You can find those at this link PHP drivers for MS-SQL

Jose
  • 21
  • 2
1

The MSSQL extension is not activated by default.

  • Do a phpinfo() to find out which php.ini file is used by your PHP installation

  • open that php.ini file

  • uncomment the line saying ;extension=php_mssql.dll (remove the semicolon)

  • Restart the server if necessary

Pekka
  • 442,112
  • 142
  • 972
  • 1,088