Home >Backend Development >PHP Tutorial >Why am I getting a 'Call to undefined function mssql_connect()' error when connecting to SQL Server from PHP?
PHP Fatal Error: Call to Undefined Function mssql_connect()
Issue:
When attempting to connect to SQL Server 2008 from PHP 5.3 running on IIS7/Windows Server 2008, users receive the fatal error "Call to undefined function mssql_connect()."
Resolution:
To resolve this issue, ensure the following:
Proper Extension Configuration:
Add the following line to C:Program Files (x86)PHPphp.ini:
extension=php_sqlsrv_53_nts.dll
PHPINFO Verification:
Access phpinfo() to check if the SQLSRV extension is loaded. Look for a section similar to the following:
SQLSRV SQLSRV support => enabled SQLSRV Info => SQLSRV Session State => enabled SQLSRV Client Adapter => yes
Correct Function Usage:
Extension Directory:
Check the extension_dir setting in php.ini. If it is not set to "ext," try specifying the full path to the directory:
extension_dir = "C:PHPext"
The above is the detailed content of Why am I getting a 'Call to undefined function mssql_connect()' error when connecting to SQL Server from PHP?. For more information, please follow other related articles on the PHP Chinese website!