[Reprint] Configure php-fpm as service in linux

1. Set php-fpm.conf and remove the semicolon in front of ;pid = run/php-fpm.pid

 

2. Copy the init.d.php- fpm in the decompressed php folder to /etc/init.d/php-fpm

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm    #init.d.php-fpm can be found by the find command

 

3. Copy the init.d.php- fpm in the decompressed php folder to /etc/init.d/php-fpm

 

 

4. Modify the php- fpm file

 

Will

 

php_fpm_BIN=@sbindir@/php-fpm
php_fpm_CONF=@sysconfdir@/php-fpm.conf
php_fpm_PID=@localstatedir@/run/php-fpm.pid

 

change to

 

php_fpm_BIN=/usr/local/php/sbin/php-fpm
php_fpm_CONF=/usr/local/php/etc/php-fpm.conf
php_fpm_PID=/usr/local/php/var/run/php-fpm.pid

 

5. Execute

chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on

 

After that, you can directly use the command service php-fpm stop and other commands

Reprinted from: https://blog.csdn.net/gws813539162/article/details/71642784

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324642553&siteId=291194637