🚨 PHP-FPM restart failed? Fix it in 1 minuteUnit php-fpm.service not found

Your system cannot find php-fpm.service, there may be the following situations:

1. Check PHP-FPM version

different Linux Distribution and PHP version,php-fpm The service name is different. Check the PHP version first:

php -v

For example, the output is:

PHP 8.1.2 (cli) (built: Jan 23 2022 09:47:36) ( NTS )

Explain that you are using PHP 8.1, then the PHP-FPM service may be php8.1-fpm.

You can view the specific FPM process with the following command:

ps aux | grep php-fpm

If the output is similar to:

root      1234  0.0  0.1 123456 12345 ? Ss   12:34   0:00 php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf)

Then your service name is php8.3-fpm.

try:

sudo systemctl restart php8.3-fpm

📌 Click the link below to learn how to do it HestiaCP PHP version query tips! 👇👇

🚨 PHP-FPM restart failed? Fix it in 1 minuteUnit php-fpm.service not found

2. Find the PHP-FPM service name

If you are unsure of the PHP-FPM service name, you can use:

systemctl list-units --type=service | grep fpm

or:

systemctl | grep php

If it returns:

php7.4-fpm.service   loaded active running   The PHP 7.4 FastCGI Process Manager

This means your PHP version is 7.4. The correct command should be:

sudo systemctl restart php7.4-fpm

3. Check if PHP-FPM is installed

如果 systemctl Can't find php-fpm, indicating that PHP-FPM may not be installed. You can run:

dpkg -l | grep php

if there is not php-fpm Related packages, install it:

sudo apt update
sudo apt install php-fpm

Then try again:

sudo systemctl restart php-fpm

4. Manually start PHP-FPM

如果 systemctl If the service is still not found, you can start it manually:

sudo /usr/sbin/php-fpm

Then check the progress:

ps aux | grep php-fpm

If PHP-FPM is started but systemctl If the service is still not found, you can create a Systemd configuration file:

sudo nano /etc/systemd/system/php-fpm.service

Add to:

[Unit]
Description=The PHP FastCGI Process Manager
After=network.target

[Service]
ExecStart=/usr/sbin/php-fpm
Restart=always
User=www-data
Group=www-data

[Install]
WantedBy=multi-user.target

then:

sudo systemctl daemon-reload
sudo systemctl enable php-fpm
sudo systemctl start php-fpm

Final Thoughts

  1. Determine PHP version (php -v)
  2. Use the correct service name (php7.4-fpm Or php8.1-fpm etc)
  3. Check if PHP-FPM is installed (dpkg -l | grep php)
  4. Manual Start (/usr/sbin/php-fpm)
  5. If there is no Systemd service, create it manually

You can try these methods and see which one solves your problem! 💡

Comment

Your email address will not be published. Required fields * Callout

Scroll to Top