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?


Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

This might sound silly, but where do I enter this command? When I launch Console, it always starts with the initial WP one-click install prompt.

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.