1. 安装 yum -y install libxml2-devel openssl-devel bzip2-devel libmcrypt-devel 解决 PHP 包的依赖关系, 可能 libmcrypt 会报错, 先执行 yum install epel-release, 再重新安装一下就可以了.
2. 下载 PHP 安装包并且上传到服务器, 解压,(或者可以用 wget 直接下载到服务器).
3. 在 PHP 包的位置编译 PHP:
- ./configure \
- --prefix=/usr/local/PHP \
- --with-config-file-path=/usr/local/PHP/etc \
- --enable-fpm --with-fpm-user=www \
- --with-fpm-group=www \
- --with-MySQL=mysqlnd \
- --with-mysqli=mysqlnd \
- --with-pdo-MySQL=mysqlnd \
- --with-iconv-dir \
- --with-freetype-dir \
- --with-jpeg-dir \
- --with-PNG-dir \
- --with-zlib \
- --with-libxml-dir=/usr \
- --enable-xml \
- --disable-rpath \
- --enable-bcmath \
- --enable-shmop \
- --enable-sysvsem \
- --enable-inline-optimization \
- --with-curl \
- --enable-mbregex \
- --enable-mbstring \
- --with-mcrypt \
- --enable-ftp \
- --with-gd \
- --enable-gd-native-ttf \
- --with-openssl \
- --with-mhash \
- --enable-pcntl \
- --enable-sockets \
- --with-xmlrpc \
- --enable-zip \
- --enable-SOAP \
- --without-Pear \
- --with-gettext \
- --disable-fileinfo \
- --enable-maintainer-zts
4.make && make install
5. 复制相关配置文件到相关位置上:
- cp PHP.INI-production /usr/local/PHP/etc/PHP.INI
- cp /usr/local/PHP/etc/PHP-fpm.conf.default /usr/local/PHP/etc/PHP-fpm.conf
- cp sapi/fpm/init.d.PHP-fpm /etc/init.d/PHP-fpm
6. 加权限并设置开机启动 PHP
7. 开启 PHP 服务:
/usr/local/PHP/sbin/PHP-fpm 或者 /etc/init.d/PHP-fpm start
8. 查看 PHP 是否启动成功:
netstat -lnt |grep 9000
9. 建一个存放 nginx 日志的文件与网站根目录:
- mkdir -p /tmp/www/feiyin.com
- mkdir -p /tmp/www/feiyin.com
来源: http://www.bubuko.com/infodetail-2970080.html