环境
系统:CentOS 7.4
软件:php-5.6.25.tar.gz
准备
- 安装依赖包
# yum -y install gcc libxml2-devel
PHP安装
下载源码包
地址:http://php.net/downloads.php-
编译安装PHP
# tar -xzvf php-5.6.35.tar.gz # cd php-5.6.35 # ./configure --prefix=/usr/local/php --enable-fpm # make # make install
-
配置环境变量
# vim /etc/profile export PATH=/usr/local/php/sbin:/usr/local/php/bin:$PATH # source /etc/profile
-
复制配置文件
# cp php.ini-production /usr/local/php/ # cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
PHP-FPM启动
-
添加启动服务
# vim /usr/lib/systemd/system/php-fpm.service [Unit] Description=The PHP FastCGI Process Manager After=syslog.target network.target [Service] Type=forking ExecStart=/usr/local/php/sbin/php-fpm PrivateTmp=true [Install] WantedBy=multi-user.target
-
启动
# systemctl enable php-fpm.service # systemctl start php-fpm.service