下载 PHP 源码包
1 | wget http://cn2.php.net/get/php-5.6.25.tar.gz/from/this/mirror -O php-5.6.25.tar.gz |
添加 epel 源
1 | wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo |
安装依赖
1 | yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel sqlite-devel -y |
创建 www 用户
1 | groupadd www |
编译
1 | cd php-5.6.25/ |
安装
1 | make -j4 && make install |
拷贝配置文件
1 | cp php.ini-development /usr/local/php/etc/php.ini |
启动 php-fpm
1 | service php-fpm start |
添加环境变量
1 | echo "PATH=$PATH:/usr/local/php/bin" >> /etc/profile |
检查
1 | php -v |