How to restart php on LAMP marketplace image?


I tried to restart php with service, systemctl or init.d/ but I unable to restart php and it says “Unit php8.0-fpm.service could not be found.”

php -v PHP 8.0.11 (cli) (built: Sep 23 2021 21:26:24) ( NTS ) Copyright © The PHP Group Zend Engine v4.0.11, Copyright © Zend Technologies with Zend OPcache v8.0.11, Copyright ©, by Zend Technologies

How can I restart php?



Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello, @mraheel83Starfish

You can first check if the php-fpm service is running using the ps command:

  1. ps axu | grep -i php

The output will help you to see which is the php-fpm process and from there you can restart the php-fpm service using the systemctl command:

  1. systemctl restart php8.0-fpm.service

Note that your version might be different and you’ll need to substitute 8.0 with the actual php-fpm version that your server runs.

Regards, Alex

First, let’s find the service name:

systemctl list-units|grep php

If a service named php comes back, restart it

If nothing comes back, that means we need to find out the web server you’re running:

systemctl list-units|grep 'nginx\|apache' # leave the \ in there

If it comes back apache, restart apache. If it comes back NGINX, let me know here, and I can help further.