1. 環(huán)境準(zhǔn)備
yum -y update
yum -y groupinstall "Development tools"
yum -y install php-gd
yum -y install freetype*
yum -y install gd
yum -y install gd-devel
yum -y install libmcrypt
yum -y install libmcrypt-devel
yum -y install freetype
yum -y install freetype-devel
yum -y install libtool-ltdl
yum -y install libtool-ltdl-devel
yum -y install libjpeg-devel
yum -y install libpng-devel
yum -y install libmcrypt
yum -y install libmcrypt-devel
yum -y install libxml2
yum -y install libxml2-devel
yum -y install curl-devel
yum -y install systemd-devel
yum -y install mysql-server mysql mysql-devel
2. 下載安裝包并解壓
wget http://jp2.php.net/distributions/php-7.0.13.tar.gz
tar -zxvf php-7.0.13.tar.gz
cd php-7.0.13
3. 編譯安裝
./configure \
--prefix=/opt/www/php7 \
--with-config-file-path=/opt/www/php7/etc \
--with-fpm-user=php \
--with-fpm-group=php \
--enable-pcntl \
--enable-fpm \
--enable-gd-native-ttf \
--enable-bcmath \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-soap \
--enable-opcache \
--enable-mysqlnd \
--enable-exif \
--enable-sockets \
--enable-mbstring \
--enable-zip \
--disable-ipv6 \
--disable-cgi \
--with-gd \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-openssl \
--with-zlib \
--with-mhash \
--with-curl \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd
make && make install
4. 配置
cp /opt/www/php7/etc/php-fpm.conf.default /opt/www/php7/etc/php-fpm.conf
cp /opt/www/php7/etc/php-fpm.d/ww.conf.default /opt/www/php7/etc/php-fpm.d/www.conf
cp php.ini-production /opt/www/php7/etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php7-fpm
5. 加入系統(tǒng)啟動(dòng)項(xiàng)
chkconfig php-fpm on
6. 啟動(dòng)服務(wù)
chmod u+x php7-fpm
#centos6
service php7-fpm start
#centos7
service php7-fpm start
systemctl restart php-fpm.service
7.1. 擴(kuò)展安裝:phpize
a. 進(jìn)入php源碼包下的ext怠李,進(jìn)入擴(kuò)展包文件
b. mv config0.m4 config.m4
c. /opt/www/php7/bin/phpize
d. ./configure --with-openssl --with-php-config=/opt/www/php7/bin/php-config
e. make && make install
f. php.ini 增加 extension=openssl.so
g. 重啟php-fpm
7.2. 擴(kuò)展安裝:pecl
pecl install {package}
8. 啟動(dòng)參數(shù)
-c 參數(shù)指定要加載的php.ini
-y 參數(shù)指定php-fpm.conf,啟用不同的監(jiān)聽(tīng)端口
最后編輯于 :2017.12.07 01:26:58
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者