php fpm Example of adding service service

  • 2021-09-24 21:34:20
  • OfStack

nginx running PHP through FastCGI has obvious advantages over Apache including PHP environment. Recently, it was reported that PHP5.4 will probably include PHP-FPM patch in the kernel, and it will be easier to run PHP on nginx server platform. Let's take a look at an example of php-fpm smooth startup and service configuration.

My php is source installed. php-fpm versions after PHP 5.3. 2 do not support the previous php-fpm (startrestartstopreload), then if php-fpm is configured as a service and smooth start/restart is added.

Configure php-fpm.conf(vi /usr/local/php54/etc/php-fpm.conf) , will pid(;pid = run/php-fpm.pid) Before; Remove.

Because php is compiled and installed, many binary files will be generated in php directory, find init. d. php-fpm, and copy it to init. d.


cp /usr/local/src/php54/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

Set permissions and add services


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

You can use the following command to manage php-fpm in the future


service php-fpm start
service php-fpm stop
service php-fpm restart
service php-fpm reload

Summarize


Related articles: