Home  >  Article  >  Backend Development  >  defined PHP connection to the database under IIS prompts mysql undefined function mysql_connect

defined PHP connection to the database under IIS prompts mysql undefined function mysql_connect

WBOY
WBOYOriginal
2016-07-29 08:42:55835browse

1.
Remove the ";" in front of the following parameters in PHP.ini:

Copy the code The code is as follows:


;extension=php_dba.dll
;extension=php_gd2.dll
;extension= php_mbstring.dll
;extension=php_mcrypt.dll
;extension=php_mysql.dll
;extension=php_mysqli.dll
;extension=php_pdo.dll
;extension=php_pdo_mysql.dll


Save the file and restart IIS
Specific instructions
In php.ini, change
;extension=php_mysql.dll
to
extension=php_mysql.dll
extension_dir = " "
Change to
extension_dir = "ext/"
Copy libmysql.dll to system32 and finally restart Just
test whether php mysql can connect
$link=mysql_connect( 'localhost ', 'root ', '123456 ');
if(!$link) echo "fail ";
else echo "success ";
mysql_close();
?>
2.
1.php_info() Check if there is a mysql item (search for the "mysql" keyword). If so, it may be a version compatibility issue
2. If not Copy libmysql.dll in the php file to x:windowssystem32. Remove the comment of the mysql module in php.ini with extension=php_mysql.dll. Restart apache. If it still doesn’t work, restart the machine and try to test using the php_info() function.
Right-click My Computer->Properties->Advanced->Environment Variables->System Environment Variables
a. Select Path in "System Environment Variables" to highlight this line, and then select "Edit" , add ";D:php" (the directory where php.exe is located) at the end of the variable value
b. "System Environment Variables"->"New"->Variable name "PHPRC"->Variable value "D :php" (the directory where php.ini is located) ->
2. Check that the PhpIniDir setting in the httpd.conf file points to the directory of Php.
3. Try to change PhpIniDir="C:/Php" in httpd.conf to PhpIniDir="C:Php".

The above introduces the defined mysql undefined function mysql_connect prompt for PHP connection to the database under IIS, including the defined content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn