Home > Article > Backend Development > Detailed explanation of how to solve the problem of fpm.service not found in PHP
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.
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
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
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 ;;
Direct execution
kill -QUIT `cat php_fpm_PID的路径`
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!