IIS PHP connection database prompt mysql undefined function mysql_connect of

  • 2020-03-31 20:48:00
  • OfStack

A,
Place the "; "in front of the following parameters in php.ini Remove:
 
;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
specify
The php.ini put inside
; The extension = php_mysql. DLL
to
The extension = php_mysql. DLL
Extension_dir = ""
to
Ext extension_dir = "/"
Just copy libmysql.dll under system32 and finally restart it
Test whether PHP mysql can connect
< ? PHP
$link=mysql_connect('localhost ', 'root ', '123456 ');
If (! Echo $link) "fail";
The else echo "success";
Mysql_close ();
? >
Second,
1. Php_info () check to see if mysql is available (search "mysql" keyword), if possible, for version compatibility
2. If you have not copied the PHP file libmysql.dll to x:windowssystem32, remove the comments from the mysql module in php.ini.
Right click on my computer -> Property - > Advanced - > Environment variable -> System environment variable
A. Select Path in "system environment variables" to highlight the line, then select "edit" and add "at the end of the variable value"; D:\ PHP "(php.exe directory)
B. "system environment variables" -> "New" - > The variable name "PHPRC" - > Variable value "D:\ PHP" (php.ini directory) ->
2. Check the PhpIniDir Settings in the httpd.conf file to point to the Php directory.
3. Try changing PhpIniDir="C:/Php" in httpd.conf to PhpIniDir="C:\Php".

Related articles: