A:
Use the phpinfo() function in your PHP code to see PHP basics
Mysql_connect () has been deprecated since PHP5.0, and is deprecated in PHP7.0. Mysqli_connect () is used instead if PHP is 7.0 or higher
Method 2:
Missing MySQL module caused by PHP installation
Mysql> install mysql from CentOs
yum install php-mysql -y
If installed, report the following warning
Headers and client library minor version mismatch. Headers:
This is due to the higher version of MySQL, the lower version of the MySQL Client API
You can uninstall php-mysql first
yum remove php-mysql -y
then
yum install php-mysqlnd -y
Finally, restart Apache
systemctl restart httpd
Ubuntu install MySQL module:
Apt to get the install php5 – mysql
Sudo DPKG — reconfigure php5 – mysql
sudo /etc/init.d/mysql restart
sudo /etc/init.d/apache2 restart
Three:
If the first two methods fail, try opening the MySQL module extension in the php.ini configuration file
Php.ini = php.ini; Extension =” related MySQL module “; To get rid of
Then make sure that the dir of extension points to the directory where the extension resides
Windows is usually under Ext and CentOS is under /usr/lib64/php.modules
The above information can be found in the PHPINFO printed information
However, when I encountered this problem, I just needed to install the PHP-MySQL module, and I didn’t need to modify php.ini
My environment is Centos7 and PHP version is PHP5.4
Use the phpinfo() function in your PHP code to see PHP basics
Mysql_connect () has been deprecated since PHP5.0, and is deprecated in PHP7.0. Mysqli_connect () is used instead if PHP is 7.0 or higher
Method 2:
Missing MySQL module caused by PHP installation
Mysql> install mysql from CentOs
yum install php-mysql -y
If installed, report the following warning
Headers and client library minor version mismatch. Headers:
This is due to the higher version of MySQL, the lower version of the MySQL Client API
You can uninstall php-mysql first
yum remove php-mysql -y
then
yum install php-mysqlnd -y
Finally, restart Apache
systemctl restart httpd
Ubuntu install MySQL module:
Apt to get the install php5 – mysql
Sudo DPKG — reconfigure php5 – mysql
sudo /etc/init.d/mysql restart
sudo /etc/init.d/apache2 restart
Three:
If the first two methods fail, try opening the MySQL module extension in the php.ini configuration file
Php.ini = php.ini; Extension =” related MySQL module “; To get rid of
Then make sure that the dir of extension points to the directory where the extension resides
Windows is usually under Ext and CentOS is under /usr/lib64/php.modules
The above information can be found in the PHPINFO printed information
However, when I encountered this problem, I just needed to install the PHP-MySQL module, and I didn’t need to modify php.ini
My environment is Centos7 and PHP version is PHP5.4
Read More:
- Fatal error: Uncaught Error: Call to undefined function mysql_connect()
- Call to undefined function oci_ Connect() problem solving
- PHP connection to MySQL database error: call to undefined function MySQL_ connect()
- After installing MySQL again under Linux, the solution of ‘MySQL module failed to start’ appears
- Linux novice: unable to locate package error solution
- In depth analysis of mysq exceeding the number of connections error 1040 (HY000): too many connections
- ERROR: Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-zsbbp6ce/mysq
- MySQL restart error the server quit without updating PID file
- ERROR 1524 (HY000): Plugin ‘auth_socket’ is not loaded How to Fix
- Fatal error: Uncaught Error: Call to undefined function mysql_ Connect() problem solving
- The server just without updating PID file and can’t connect to local MySQL server through socket are solved
- Failed to enable APR appears when the cmder of ubutun system in win subsystem installs Apache_ TCP_ DEFER_ ACCEPT
- Connection between PHP 7.4 and MySQL (MariaDB) under Ubuntu (kali Linux)
- Spoop export hive to MySQL
- How to view the version of MySQL database
- ERROR 2002 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)
- Uncaught error: call to undefined function MySQL when building sqli lab environment with phpstudy_ Connect() error
- MYSQL login error: mysqladmin: connect to server at’localhost’ failed
- Error 2003 (HY000): can’t connect to MySQL server on ‘localhost’ (10061)
- Centos7 quick installation of docker and configuration of image acceleration