Photo by Ben Griffiths on Unsplash
How to Start, Restart, Stop and Reload PHP-FPM Service and Check service status and active PHP version on Ubuntu Linux Severs
Many web servers like Nginx, Apache and other, PHP-FPM is a FastCGI process manager for PHP. Sometimes we need to restart the server for various reasons: changing settings for example, and depending on what Linux we have on the server there are some variations in the commands used.
Use the following command for relevant tasks:
$ sudo systemctl start php7.4-fpm.service # start php-fpm
$ sudo systemctl stop php7.4-fpm.service # stop php-fpm
$ sudo systemctl restart php7.4-fpm.service # restart php-fpm
$ sudo systemctl reload php7.4-fpm.service # reload php-fpm
In order to check active php-fpm service status, please use below command and replace with relevant php version eg., php7.3-fpm.service
$ sudo systemctl status php7.4-fpm.service
The examples are for php-fpm version 7.4, but for other versions you have to change the command to correspond to the installed / active version.
To find out the php version, use the following command:
$ php -version
(OR)
$ php -v
Then you will see the output as like the screenshot of active php version and it's showing as PHP 7.4.22.