1. 程式人生 > >Linux環境PHP7安裝

Linux環境PHP7安裝

一.下載

二.解壓安裝

tar zxvf php-7.0.2.tar.gz
cd php-7.0.2

執行安裝前的檢查和配置

./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
 --with-curl \
 --with-freetype-dir \
 --with-gd \
 --with-gettext \
 --with-iconv-dir \
 --with-kerberos \
 --with-libdir=lib64 \
 --with-libxml-dir \
 --with-mysqli \
 --with-openssl \
 --with-pcre-regex \
 --with-pdo-mysql \
 --with-pdo-sqlite \
 --with-pear \
 --with-png-dir \
 --with-xmlrpc \
 --with-xsl \
 --with-zlib \
 --enable-fpm \
 --enable-bcmath \
 --enable-libxml \
 --enable-inline-optimization \
 --enable-gd-native-ttf \
 --enable-mbregex \
 --enable-mbstring \
 --enable-opcache \
 --enable-pcntl \
 --enable-shmop \
 --enable-soap \
 --enable-sockets \
 --enable-sysvsem \
 --enable-xml \
 --enable-zip

如果配置錯誤,需要安裝需要的模組,直接yum一併安裝依賴庫

yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel

編譯安裝

make &&  make install

配置檔案

cp php.ini-development /usr/local/php/lib/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm

啟動

/etc/init.d/php-fpm
service httpd restart

轉自:https://www.cnblogs.com/yangwenxin/p/6653450.html