开发者

MS SQL connection with PHP fatal error [duplicate]

开发者 https://www.devze.com 2023-01-27 02:28 出处:网络
This question already has an answer here: Call to undefined function mssql_connect() (1 answer) Closed 9 years ago.
This question already has an answer here: Call to undefined function mssql_connect() (1 answer) Closed 9 years ago.

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.


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号