zoukankan      html  css  js  c++  java
  • 编译安装php7.0.0

    参考文档:http://blog.csdn.net/wufei1314a/article/details/52299967

    1.下载php7源码包

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

    2.解压源码包

    # tar -xvf php7.tar.gz

    3.安装php依赖包 

    # 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

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

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

    4.进入目录

    # cd php-7.0.1 

    5.编译配置,这里如果上一步的某些依赖包没有安装好,就会遇到很多configure error,我们一一解决,安装上相关软件开发包就可以

    复制代码
    复制代码

    # ./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-opcache

    复制代码
    复制代码

    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

  • 相关阅读:
    cookie和session详解
    MacOS Sierra10.12.4编译Android7.1.1源代码必须跳的坑
    LeetCode——4Sum &amp; 总结
    C#深拷贝
    iOS9中怎样注冊远程通知
    hdu1542 Atlantis (线段树+扫描线+离散化)
    HTML杂记
    OpenCV中图像算术操作与逻辑操作
    java集群优化——ORM框架查询优化原理
    RVM切换ruby版本号
  • 原文地址:https://www.cnblogs.com/yangchunlong/p/8478823.html
Copyright © 2011-2022 走看看