php php-fpm 配置见解

Posted 熊二

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php php-fpm 配置见解相关的知识,希望对你有一定的参考价值。

来源:php官方文档

Init script setup
===

You will probably want to create an init script for your new php-fpm. Fortunately, PHP 5.3.3 provides one for you, which you should copy to your init directory and change permissions:

$ cp <php-5.3.3-source-dir>/sapi/fpm/init.d.php-fpm.in /etc/init.d/php-fpm
$ chmod 755 /etc/init.d/php-fpm

It requires a certain amount of setup. First of all, make sure your php-fpm.conf file is set up to  create a PID file when php-fpm starts. E.g.:
----
pid = /var/run/php-fpm.pid
----
(also make sure your php-fpm user has permission to create this file).

Now open up your new init script (/etc/init.d/php-fpm) and set the variables at the top to their relevant values. E.g.:
---
prefix=
exec_prefix=
php_fpm_BIN=/sbin/php-fpm
php_fpm_CONF=/etc/php-fpm.conf
php_fpm_PID=/var/run/php-fpm.pid
---

Your init script is now ready. You should now be able to start, stop and reload php-fpm:

$ /etc/init.d/php-fpm start
$ /etc/init.d/php-fpm stop
$ /etc/init.d/php-fpm reload

The one remaining thing you may wish to do is to add your new php-fpm init script to system start-up. E.g. in CentOS:

$ /sbin/chkconfig php-fpm on

===========

Disclaimer: Although I did just do this on my own server about 20 mins ago, everything I‘ve written here is off the top of my head, so it may not be 100% correct. Also, allow for differences in system setup. Some understanding of what you are doing is assumed.




































以上是关于php php-fpm 配置见解的主要内容,如果未能解决你的问题,请参考以下文章

PHP配置优化:php-fpm配置解读

配置php-fpm参数

PHP-fpm配置文件

php-fpm 启动参数及重要配置详解

php配置php-fpm启动参数及配置详解

php-fpm的pool,php-fpm慢执行日志,open_basedir,php-fpm进程管理