Mysql_connect () function is a PHP and MySQL database connection function, if your PHP does not support mysql_connect () function is your database can not be connected with MySQL, let me summarize the solution mysql_connect () Methods that cannot be used.
If it is Apache environment, we refer to the following ways to solve
One, in the system system32 (C:/WINDOWS/SYSTEM32) directory is missing Libmysql.dll file, the solution is to find the PHP directory Libmysql.dll, and copy Libmysql.dll to c:/windows/ System32 directory, and then restart the Web service.
Second, in the php.ini file under the C:/windows directory, there is no “; extension=php_mysql.dll” in front of a “; ” remove, so can not use the corresponding function, the workaround is to open the php.ini file found; Extension=php_mysql.dll Change to
Extension=php_mysql.dll//Remove the front; make it effective
Third, the MySQL directory does not have read permissions, the correct directory permissions are as follows:
Administrator Full Control
System Full Control
Users Read and run + List folder Directory + read
Remove all other user rights, and then restart the MySQL service and Web service
(Note: The above settings have no security settings; recommend that you restart the server after modifying)
It is important to check the permissions of the php.ini file, check the permissions of the PHP files copied to the System32, and check the permissions of the PHP installation directory folder. At a minimum, you must have the users default permissions. The Temp folder must have at least the Users group modify level permissions.
However, all the methods have been tried, or failed to solve, so I searched for a bit mysql_connect () does not support,
Save the following code as phpinfo.php:
<?phpphpinfo ();? >
If the IIS environment we refer to the following ways to resolve
You need to be aware of when consolidating IIS and PHP:
Install PHP
(1) Unzip the downloaded Php-5.1.4-win32.zip file and copy it to:
x:/server_core/php;
(2) Enter the x:/server_core/php folder and rename the php.ini-dist to php.ini;
(3) Open php.ini file to find:
Extension_dir = "./"
change it to;
Extension_dir = "X:/server_core/php/ext"
(4) Found: Windows Extensions
In the dynamic module configuration under Windows Extensions, you need to open the following module support: (Remove the module configuration in front of each line;
Extension=php_mbstring.dll
Extension=php_gd2.dll
Extension=php_mysql.dll
(5) Found:
Disable_functions =
Switch
Disable_functions =
Passthru,exec,system,popen,chroot,escapeshellcmd,escapeshellarg,shell_exec,proc_open,proc_get_status Fourth:
--------------------------------------------------------------------------------
(4) Found: Windows Extensions
In the dynamic module configuration under Windows Extensions, you need to open the following module support: (Remove the module configuration in front of each line;
Extension=php_mbstring.dll
Extension=php_gd2.dll
Extension=php_mysql.dll-----> is because of the semicolon in front of this line “; ” did not remove to cause the above error, that is, remove the semicolon, restart the Apache server can!!!