Home >Backend Development >PHP Tutorial >Why am I getting a 'Call to undefined function mssql_connect()' error when connecting to SQL Server in PHP?
PHP Fatal Error: Call to Undefined Function mssql_connect()
Problem:
When trying to connect to a SQL Server 2008 instance using PHP 5.3 on IIS7 and Windows Server 2008, you may encounter a fatal error: "Call to undefined function mssql_connect()."
Solution:
You are likely using the incorrect function for your PHP configuration. Here's what you need to do:
1. Ensure the SQLSRV Extension is Enabled:
Confirm that the SQLSRV extension is properly installed and enabled in your php.ini file:
extension=php_sqlsrv_53_nts.dll
2. Use the Correct Function:
You have installed Microsoft's SQLSRV extension, which requires the use of sqlsrv_connect() instead of mssql_connect().
Additional Troubleshooting:
The above is the detailed content of Why am I getting a 'Call to undefined function mssql_connect()' error when connecting to SQL Server in PHP?. For more information, please follow other related articles on the PHP Chinese website!