Home >Backend Development >PHP Problem >What should I do if linux php cannot connect to the mysql database?

What should I do if linux php cannot connect to the mysql database?

藏色散人
藏色散人Original
2021-10-26 09:48:243195browse

Solution to the problem that linux php cannot connect to the mysql database: 1. Execute the command "apt install php-mysql"; 2. Restart the apache2 server by executing "service apache2 restart".

What should I do if linux php cannot connect to the mysql database?

The operating environment of this article: linux5.9.8 system, PHP7.2 version, DELL G3 computer

linux php cannot connect to mysql What about the database?

php cannot connect to mysql database in Linux (Ubuntu) environment

The reason is most likely that the php-mysql module is not installed;

The solution is as follows:

apt install php-mysql

After the installation is completed, execute the following command to restart the apache2 server

service apache2 restart

The following is the rendering:
What should I do if linux php cannot connect to the mysql database?

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What should I do if linux php cannot connect to the mysql database?. For more information, please follow other related articles on the PHP Chinese website!

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