centos6.9 PHP的編譯安裝並連接nginx
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-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 \
--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 \
--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
centos6.9 PHP的編譯安裝並連接nginx