Home > Article > Backend Development > How to deal with PHP7-FPM startup failure under Linux
PHP7-FPM under Linux is a common PHP FastCGI process manager, usually used to handle the running of PHP programs. However, sometimes during the configuration or deployment process, you may encounter a situation where PHP7-FPM fails to start, causing the website to be unable to be accessed normally. In this case, we need to take some measures to deal with and solve the problem.
1. Check the error log
First check the error log of PHP7-FPM, usually the error log is located at /var/log/php7-fpm/error .log
or /var/log/php-fpm.log
. You can learn the specific cause of startup failure by checking the error log.
cat /var/log/php7-fpm/error.log
2. Check the configuration file
Check whether the PHP7-FPM configuration file has errors or is incomplete, mainly focus on/etc/php/7 .x/fpm/php-fpm.conf
and /etc/php/7.x/fpm/pool.d/www.conf
.
You can check whether the syntax of the configuration file is correct by running the following command:
php7-fpm -t
3. Check the port occupation
If the port of PHP7-FPM is used by other Process occupation will also cause startup failure. You can check the port occupancy through the following command:
netstat -tunlp | grep 9000
If you find that the port is occupied, you can try to modify it in /etc/php/7.x/fpm/pool.d/www.conf
Replace the listen
parameter with other available ports.
4. Restart PHP7-FPM
Generally, you can restart PHP7-FPM through the following command:
service php7-fpm restart
5. Check PHP extensions and dependencies
Sometimes PHP7-FPM fails to start due to the lack of some PHP extensions or dependent library files. You can check whether the PHP extension has been installed by running the following command:
php -m
If you find that some extensions are missing, you can install them with the following command:
apt-get install php7.0-mysql php7.0-curl
6. Rebuild the PHP7-FPM Socket file
Sometimes the Socket file of PHP7-FPM is damaged Or incorrect permissions may cause startup failure. You can rebuild the Socket file through the following command:
rm /var/run/php/php7.0-fpm.sock service php7-fpm restart
The above are some common methods to deal with PHP7-FPM startup failure under Linux. I hope it can help you solve the problem. If the problem persists, it is recommended to check the official documentation or seek help in the technical forum.
The above is the detailed content of How to deal with PHP7-FPM startup failure under Linux. For more information, please follow other related articles on the PHP Chinese website!