安装php环境

环境:
192.168.11.20 PHP(主机名) PHP节点
关闭防火墙
配置好yum源
用centos7.5-1804
(1)安装配置基础服务
[root@localhost php-5.6.27]# yum install -y gcc gcc-c++ libxml2-devel libcurl-devel openssl-devel bzip2-devel
 
将提前准备好的libmcrypt-2.5.8.tar.gz和php-5.6.27.tar.gz解压到/root
 
tar -zxvf libmcrypt-2.5.8.tar.gz
进入目录编辑该服务
cd libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt && make install
 
安装PHP环境
tar -zxvf php-5.6.27.tar.gz
cd php-5.6.27
./configure --prefix=/usr/local/php5.6 --with-mysql=mysqlnd \
--with-pdo-mysql-mysqlnd --with-mysqli=mysqlnd --with-openssl --enable-fpm \
--enable-sockets --enable-sysvshm --enable-mbstring --with-freetype-dir --with-jpeg-dir \
--with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-mhash \
--with-mcrypt=/usr/local/libmcrypt --with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts
没有报错进行下一步安装
 
make && make install
创建用户(如果做分布式inmp+WordPress php节点和nginx节点用户一致)
groupadd -g 1001 nginx
useradd -u 900 nginx -g nginx -s /sbin/nologin
tail -1 /etc/passwd
 
(3)配置PHP环境
cd /root/php5.6.27
cp php.ini-production /etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm (赋予执行权限)
 
开启开机自启动
chkconfig --add php-fpm
chkconfig php-fpm on
 
修改配置文件
cp /usr/local/php5.6/etc/php-fpm.conf.default /usr/local/php5.6/etc/php-fpm.conf
vim /usr/local/php5.6/etc/php-fpm.conf
[root@localhost ~]# grep -n '^'[a-Z] /usr/local/php5.6/etc/php-fpm.conf
25:pid = run/php-fpm.pid
149:user = nginx
150:group = nginx
164:listen = 192.168.11.20:9000
224:pm = dynamic
235:pm.max_children = 50
240:pm.start_servers = 5
245:pm.min_spare_servers = 5
250:pm.max_spare_servers = 35
 
启动PHP服务(重启php-fpm服务)
[root@localhost ~]# systemctl restart php-fpm
使用netstat -ntpl来查看结果
0
 
posted @ 2022-11-25 11:08  小白-cloud  阅读(166)  评论(0)    收藏  举报