Home  >  Article  >  Backend Development  >  php mysql_connect() unsupported solution_PHP tutorial

php mysql_connect() unsupported solution_PHP tutorial

不言
不言Original
2018-05-28 17:37:457510browse

The mysql_connect() function is a function that connects php to mysql database. If your php does not support the mysql_connect() function, it means that your database cannot be connected to mysql. Let me summarize how to solve mysql_connect() ) cannot be used.

Recommended related mysql video tutorials: "mysql tutorial"

If it is an apache environment, we can refer to the following method to solve the problem

1. The libmysql.dll file is missing in the system’s system32 (C:/windows/system32) directory. The solution is to find libmysql.dll in the php directory and copy libmysql.dll to the C:/windows/system32 directory. , and then restart the web service.

2. In the php.ini file in the C:/windows directory, the first ";" in "extension=php_mysql.dll" has not been removed, so the corresponding function cannot be used. The solution is to open the php.ini file and find; extension=php_mysql.dll and change it to

extension=php_mysql.dll    //去掉前面的;使之生效

3. The Mysql directory does not have read permissions. The correct directory permissions are as follows:

administrator   完全控制
system          完全控制
users           读取和运行+列出文件夹目录+读取

Delete all other user permissions, and then restart the MYsql service and Web service
(Note: There are no security settings for the above settings; it is recommended to restart the server after modification)

Important, also check the permissions of the php.ini file , check the permissions of the PHP file copied to system32, and check the permissions of the PHP installation directory folder. It must have at least the users default permissions. The temp folder must have at least the users group modification level permissions.

However, all I tried all the methods, but still couldn't solve it, so I searched that mysql_connect() is not supported.
Save the following code as phpinfo.php:

<?php
phpinfo();
?>

If For the iis environment, we refer to the following methods to solve the problem

What you need to pay attention to when integrating 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 php.ini-dist to php.ini;
(3) Open the php.ini file and find:

extension_dir = "./"

and change it to; 🎜>In the dynamic module configuration under Windows Extensions, you need to turn on the following module support: (remove the ; number in front of each line of the module configuration)

 extension_dir = "X:/Server_Core/PHP/ext"

(5) Found:

extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_mysql.dll
is changed to: 


disable_functions =
The fourth one:

---------------- -------------------------------------------------- -------------

disable_functions =
passthru,exec,system,popen,chroot,escapeshellcmd,escapeshellarg,shell_exec,proc_open,proc_get_status
(4) Found: Windows Extensions

In the dynamic module configuration under Windows Extensions, you need to turn on the following module support: (Remove The ; sign in front of each line of the module configuration is sufficient)

-----> It is because the semicolon ";" in front of this line is not removed that causes the above error, that is, remove it Semicolon, just restart the Apache server! ! !


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