[root@opstrip opt]# mkdir -p /etc/php-fpm.d
[root@opstrip opt]# cp /usr/etc/php-fpm.conf.default /etc/sysconfig/php-fpm.conf
[root@opstrip opt]# cp /usr/etc/php-fpm.d/www.conf.default /etc/php-fpm.d/www.conf
[root@opstrip opt]# cp /opt/php-5.6.30/sapi/fpm/php-fpm.service.in /usr/lib/systemd/system/php-fpm.service
[root@opstrip opt]# vi /usr/lib/systemd/system/php-fpm.service
# It's not recommended to modify this file in-place, because it
# will be overwritten during upgrades. If you want to customize,
# the best way is to use the "systemctl edit" command.
[Unit]
Description=The PHP FastCGI Process Manager
After=network.target
[Service]
Type=simple
PIDFile=/usr/var/run/php-fpm.pid
ExecStart=/usr/sbin/php-fpm --nodaemonize --fpm-config /etc/sysconfig/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
[root@opstrip opt]# systemctl enable php-fpm # 使php-fpm开机启动
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.
[root@opstrip opt]# systemctl start php-fpm # 启动php-fpm服务
[root@opstrip opt]# ps -ef|grep php-fpm # 查看php-fpm进程
root 14563 1 0 11:23 ? 00:00:00 php-fpm: master process (/etc/sysconfig/php-fpm.conf)
www 14564 14563 0 11:23 ? 00:00:00 php-fpm: pool www
www 14565 14563 0 11:23 ? 00:00:00 php-fpm: pool www
root 14567 14426 0 11:23 pts/2 00:00:00 grep --color=auto php-fpm