Here’s how to restart PHP-FPM on various operating systems:
Debian/Ubuntu:
- Use the following command:
sudo systemctl restart php8.0-fpm
(Replace “php8.0” with your specific PHP version if different)
CentOS/RHEL:
- Use this command:
sudo systemctl restart php-fpm
Fedora:
- Use this command:
sudo systemctl restart php-fpm.service
Alternative Methods (if the above commands don’t work):
- Check for specific service name:
sudo systemctl list-units | grep php-fpm
Use the exact service name from the output in the restart command.
- Directly restart the process:
sudo killall -HUP php-fpm
Troubleshooting:
- Check status: Verify if PHP-FPM is running with:
sudo systemctl status php-fpm
- View logs: Look for errors in the PHP-FPM logs (usually in /var/log/php-fpm) for more clues.
Important Notes:
- Root privileges: You’ll need root privileges (using
sudo
) to restart PHP-FPM. - Service names: Service names might vary slightly depending on your system and configuration.
- Multiple PHP versions: If you have multiple PHP versions, specify the correct one in the restart command.
- Web server integration: Ensure your web server is configured to use the correct PHP-FPM socket or port after restarting.