PHP-FPM (FastCGI Process Manager) is an essential service that manages PHP requests on a web server. Restarting PHP-FPM is often required after making configuration changes, updating PHP versions, or troubleshooting issues. This guide will show different methods to restart PHP-FPM based on your server’s operating system and PHP version.
Most modern Linux distributions, including Ubuntu, Debian, CentOS, and RHEL, use systemd to manage services. Use the following command:
sudo systemctl restart php-fpm
For specific PHP versions (e.g., PHP 7.4 or PHP 8.1), specify the version:
sudo systemctl restart php7.4-fpm
sudo systemctl restart php8.1-fpm
To check the status of PHP-FPM:
sudo systemctl status php-fpm
Some older Linux distributions use the service command instead of systemctl:
sudo service php-fpm restart
For specific PHP versions:
sudo service php7.4-fpm restart
sudo service php8.1-fpm restart
On legacy systems that still rely on SysVinit, restart PHP-FPM with:
sudo /etc/init.d/php-fpm restart
For a specific PHP version:
sudo /etc/init.d/php7.4-fpm restart
Instead of a full restart, you can reload PHP-FPM to apply changes without terminating existing connections:
sudo systemctl reload php-fpm
For specific PHP versions:
sudo systemctl reload php7.4-fpm
If a restart command doesn’t work, manually stopping and starting PHP-FPM can help:
sudo systemctl stop php-fpm
sudo systemctl start php-fpm
If PHP-FPM is unresponsive, manually kill all processes and restart:
sudo pkill -9 php-fpm
sudo systemctl start php-fpm
Restarting PHP-FPM is a crucial step in maintaining web server performance and applying configuration changes. Depending on your Linux distribution and PHP version, you can use systemctl, service, init.d, or manual process termination to restart PHP-FPM effectively.