Home >Backend Development >PHP Problem >What should I do if linux php cannot connect to the mysql database?
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".
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:
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!