Detailed explanation of how to solve the problem of fpm.service not found in PHP

怪我咯
Release: 2023-03-10 14:18:01
Original
11106 people have browsed it

This article mainly introduces to you how to solve the problem of php-fpm.service not found. The ideas and process of solving this problem are introduced in detail in the article. I will share it with you. If you have friends with the same problem, you don’t have to look around. There is a solution, let’s take a look below.

Preface

This article gives you a detailed introduction to the relevant content of solving the problem of php-fpm.service not found. The introduction in the article is very detailed. Let’s take a look at the detailed introduction:

Environment introduction

Environment: ubuntu 16.04 64

php Version: php -7.1.4

Found the problem

Compile and install php normally. Follow the previous process and put init.d.php-fpm Copy to /etc/init.d/php-fpm

Then prepare to execute service php-fpm start An error occurred

The error is as follows

Failed to start php-fpm.service: Unit php-fpm.service not found.
Copy after login

Promptphp-fpm.service not found

At first I thought it was a problem with php compilation and installation, so I went directly to the php directory Execute php-fpm, everything is normal

But I can't manage it with service

View the php-fpm management script directly, try to debug, and finally find that when executing the service command, there is no problem at all This script was not executed

Basically eliminate the problem with php

Solution

Finally looked for service Command information, find the solution

In ubuntu 16.04, in addition to copying the file to the /etc/init.d/ directory to add a service, you also need to use the following command

update-rc.d php-fpm defaults

// 添加
update-rc.d ServiceName defaults

// 删除

update-rc.d ServiceName remove
Copy after login

After solving the problem, I found that I had run php-fpm separately before and now there is a problem running service

[05-May-2017 17:09:32] ERROR: An another FPM instance seems to already listen on /run/php/php7.0-fpm.sock
[05-May-2017 17:09:32] ERROR: FPM initialization failed
Copy after login

Prompt that we already have a php-fpm running. Since I am running it in sock mode, I cannot find the pid. I looked at the code of the php-fpm management script and found a solution.

stop) 
 echo -n "Gracefully shutting down php-fpm "

 if [ ! -r $php_fpm_PID ] ; then
  echo "warning, no pid file found - php-fpm is not running ?"
  exit 1
 fi

 kill -QUIT `cat $php_fpm_PID`

 wait_for_pid removed $php_fpm_PID

 if [ -n "$try" ] ; then
  echo " failed. Use force-quit"
  exit 1
 else
  echo " done"
 fi
 ;;
Copy after login

Direct execution

kill -QUIT `cat php_fpm_PID的路径`
Copy after login

The above is the detailed content of Detailed explanation of how to solve the problem of fpm.service not found in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template