标签:linux pat ref tar www serve type client pdo
1.安装依赖包
yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
2.下载安装包
cd /usr/local wget https://www.php.net/distributions/php-7.1.31.tar.gz
3.解压
tar -zxvf php-7.1.31.tar.gz
4.这里只打开fpm、安装mysqli驱动包,有需求可自行加入依赖包
cd php-7.1.31
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --enable-fpm --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd
5.编译安装
make
make install
6.在之前编译的源码包中,找到 php.ini-production,复制到/usr/local/php下,并改名为php.ini:
cp php.ini-production /usr/local/php/php.ini
7.复制启动脚本
cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm
修改php-fpm配置文件:
cd /usr/local/php/etc cp php-fpm.conf.default php-fpm.conf
去掉 pid = run/php-fpm.pid 前面的分号
vi php-fpm.conf
拷贝www.conf文件
cd php-fpm.d cp www.conf.default www.conf
8.启动PHP
/etc/init.d/php-fpm start #php-fpm启动命令 /etc/init.d/php-fpm stop #php-fpm停止命令 /etc/init.d/php-fpm restart #php-fpm重启命令
查看是否已经成功启动PHP
ps -ef | grep php
9.开机自启动
将 /etc/init.d/php-fpm start 添加到rc.local文件里面
vi /etc/rc.local
chmod +x /etc/rc.d/rc.local
10.大功告成!
标签:linux pat ref tar www serve type client pdo
原文地址:https://www.cnblogs.com/front-web/p/14338833.html