Restarting PHP-FPM on AvaHost VPS: A Quick Guide

PHP-FPM (FastCGI Process Manager) handles PHP requests on AvaHost’s high-performance VPS, powering dynamic websites like WordPress or custom applications. Restarting PHP-FPM is necessary after configuration changes, PHP upgrades, or to troubleshoot issues like 502 errors. This guide provides simple methods to restart PHP-FPM on AvaHost’s Ubuntu or CentOS VPS, leveraging NVMe SSDs and LiteSpeed compatibility for optimal performance.

Prerequisites

  • AvaHost Linux VPS (e.g., VPS Basic, €10/month) with Ubuntu or CentOS.

  • Root or sudo access (ssh root@your-vps-ip).

  • PHP-FPM installed (default with AvaHost’s LAMP stack or cPanel).

  • Knowledge of your PHP version (e.g., 7.4, 8.1) via:

    php -v

1. Restart PHP-FPM Using systemctl (Modern Linux Systems)

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

2. Restart PHP-FPM Using service (Older Systems)

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

3. Restart PHP-FPM Using init.d (Legacy Systems)

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

4. Reload PHP-FPM Without Dropping Connections

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

5. Stop and Start PHP-FPM Manually

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

6. Kill and Restart PHP-FPM Processes

If PHP-FPM is unresponsive, manually kill all processes and restart:

sudo pkill -9 php-fpm
sudo systemctl start php-fpm

Conclusion

Restarting PHP-FPM on AvaHost’s VPS is straightforward using systemctl, service, or manual methods, ensuring smooth operation for PHP-based applications like WordPress or custom CMS. AvaHost’s NVMe SSDs, LiteSpeed integration, and cPanel tools enhance performance and simplify management.