一、安装依赖

yum -y install gcc gcc-c++ libxml2 libxml2-devel openssl openssl-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel pcre pcre-devel libxslt libxslt-devel libtool zlib-devel bzip2 bzip2-devel

二、上传php-fpm程序文件包到/opt/目录下并解压

cd /opt
tar -zxvf php7.1.22.tar.gz

三、上传启动文件

cp php-fpm.service /usr/lib/systemd/system/

四、创建php-fpm运行用户

useradd www;echo 12345 | passwd --stdin www
#创建www用户及用户组。

useradd www -s /sbin/nologin -M
#创建www用户及用户组,同时禁止登陆系统。

五、修改属组属主

chown -R www:www /opt/php7

六、启动服务

systemctl enable php-fpm
systemctl start php-fpm

七、附录

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=/opt/php7.2/var/run/php-fpm.pid
ExecStart=/opt/php7.2/sbin/php-fpm --nodaemonize --fpm-config /opt/php7.2/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

标签: none

添加新评论