編譯安裝php7.0.0

參考文檔:http://blog.csdn.net/wufei1314a/article/details/52299967php

1.下載php7源碼包html

# cd /root & wget -O php7.tar.gz http://cn2.php.net/get/php-7.0.1.tar.gz/from/this/mirror

2.解壓源碼包mysql

# tar -xvf php7.tar.gz

3.安裝php依賴包 nginx

# yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt-devel readline readline-devel libxslt libxslt-devel

 

安裝libmcrypt

web

wget https://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gzsql

tar -zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt
make && make installjson

4.進入目錄vim

# cd php-7.0.1 

 

5.編譯配置,這裏若是上一步的某些依賴包沒有安裝好,就會遇到不少configure error,咱們一一解決,安裝上相關軟件開發包就能夠api

複製代碼
複製代碼

# ./configure \
--prefix=/usr/local/web/php \
--with-config-file-path=/usr/local/web/php/etc \
--enable-fpm \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt=/usr/local/libmcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-openssl-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-freetype-dir \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-opcachebash

複製代碼
複製代碼

configure error:

1.configure: error: xml2-config not found. Please check your libxml2 installation.

解決:

1
<span style= "color: #ff0000" ># yum  install  libxml2 libxml2-devel< /span >

 

2.configure: error: Cannot find OpenSSL's <evp.h>

解決:

1
<span style= "color: #ff0000" ># yum  install  openssl openssl-devel< /span >

 

3.configure: error: Please reinstall the BZip2 distribution

解決:

1
<span style= "color: #ff0000" ># yum  install  bzip2  bzip2 -devel< /span >

 

4.configure: error: Please reinstall the libcurl distribution - easy.h should be in <curl-dir>/include/curl/

解決:

1
<span style= "color: #ff0000" ># yum  install  libcurl libcurl-devel< /span >

 

5.If configure fails try --with-webp-dir=<DIR> configure: error: jpeglib.h not found.

 

解決:

1
<span style= "color: #ff0000" ># yum  install  libjpeg libjpeg-devel< /span >

6.If configure fails try --with-webp-dir=<DIR>

checking for jpeg_read_header in -ljpeg... yes

configure: error: png.h not found.

解決:

1
<span style= "color: #ff0000" ># yum  install  libpng libpng-devel< /span >

 

7.If configure fails try --with-webp-dir=<DIR>

checking for jpeg_read_header in -ljpeg... yes

checking for png_write_image in -lpng... yes

If configure fails try --with-xpm-dir=<DIR>

configure: error: freetype-config not found.

解決:

1
<span style= "color: #ff0000" ># yum  install  freetype freetype-devel< /span >

8.configure: error: Unable to locate gmp.h

解決:

1
<span style= "color: #ff0000" ># yum  install  gmp gmp-devel< /span >

9.configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解決:

  # yum install libmcrypt libmcrypt-devel

10.configure: error: Please reinstall readline - I cannot find readline.h

解決:

1
<span style= "color: #ff0000" ># yum  install  readline readline-devel< /span >

11.configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

解決:

1
<span style= "color: #ff0000" ># yum  install  libxslt libxslt-devel< /span >

6.編譯與安裝

# make && make install

這裏要make很久,要耐心一下

 7.添加 PHP 命令到環境變量

# vim /etc/profile

在末尾加入

PATH=$PATH:/usr/local/web/php/bin

export PATH

要使改動當即生效執行

# source /etc/profile

查看環境變量

# echo $PATH

查看php版本

# php -v

8.配置php-fpm

# cp php.ini-production /etc/php.ini
# cp /usr/local/web/php/etc/php-fpm.conf.default /usr/local/web/php/etc/php-fpm.conf

# cp /usr/local/web/php/etc/php-fpm.d/www.conf.default /usr/local/web/php/etc/php-fpm.d/www.conf
# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
# chmod +x /etc/init.d/php-fpm

PHP-fpm配置參考:http://www.cnblogs.com/yangchunlong/p/8480258.html

9.啓動php-fpm

# /etc/init.d/php-fpm start

寶塔界面安裝參考:ttps://www.cnblogs.com/paul8339/p/7065799.html

php.ini經常使用配置項:http://blog.csdn.net/wkupaochuan/article/details/8646738

PHP配置文件詳解php.ini:http://www.360doc.com/content/16/0315/09/15774578_542312495.shtml

相關文章
相關標籤/搜索