zoukankan      html  css  js  c++  java
  • 在CentOS7上源码安装php7--Install php7 from source on CentOS7

    首先下载php源码包并解压:

    # wget http://cn2.php.net/get/php-7.0.9.tar.gz/from/this/mirror
    # tar -xvf php-7.0.9.tar.gz
    # cd php-7.0.9

    然后开始./configrue

    ./configure --enable-fpm --with-mysql

    这里我只包含了 PHP-FPM 和 MySQL 支持的简单配置, 可以通过运行 ./configure --help 命令来获得完整的可用选项清单

    configure过程中可能会出现的问题:

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

    解决办法:

    # rpm -qa|grep libxml2
    libxml2-python-2.9.1-5.el7_1.2.x86_64
    libxml2-2.9.1-5.el7_1.2.x86_64

    没有libxml2-devel

    yum install libxml2-devel

    问题解决!

    configure完成后

    +--------------------------------------------------------------------+
    | License:                                   |
    | This software is subject to the PHP License, available in this    |
    | distribution in the file LICENSE. By continuing this installation |
    | process, you are bound by the terms of this license agreement.    |
    | If you do not agree with the terms of this license, you must abort |
    | the installation process at this point.    |
    +--------------------------------------------------------------------+

    config.status: creating php7.spec
    config.status: creating main/build-defs.h
    config.status: creating scripts/phpize
    config.status: creating scripts/man1/phpize.1
    config.status: creating scripts/php-config
    config.status: creating scripts/man1/php-config.1
    config.status: creating sapi/cli/php.1
    config.status: creating sapi/cgi/php-cgi.1
    config.status: creating ext/phar/phar.1
    config.status: creating ext/phar/phar.phar.1
    config.status: creating main/php_config.h
    config.status: executing default commands

    继续安装

    make && make install

    经过“漫长”的等待后,编译完成

    Build complete.
    Don't forget to run 'make test'.
    Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20151012/
    Installing PHP CLI binary: /usr/local/bin/
    Installing PHP CLI man page: /usr/local/php/man/man1/
    Installing phpdbg binary: /usr/local/bin/
    Installing phpdbg man page: /usr/local/php/man/man1/
    Installing PHP CGI binary: /usr/local/bin/
    Installing PHP CGI man page: /usr/local/php/man/man1/
    Installing build environment: /usr/local/lib/php/build/
    Installing header files: /usr/local/include/php/
    Installing helper programs: /usr/local/bin/
    program: phpize
    program: php-config
    Installing man pages: /usr/local/php/man/man1/
    page: phpize.1
    page: php-config.1
    Installing PEAR environment: /usr/local/lib/php/
    [PEAR] Archive_Tar - installed: 1.4.0
    [PEAR] Console_Getopt - installed: 1.4.1
    [PEAR] Structures_Graph- installed: 1.1.1
    [PEAR] XML_Util - installed: 1.3.0
    [PEAR] PEAR - installed: 1.10.1
    Wrote PEAR system config file at: /usr/local/etc/pear.conf
    You may want to add: /usr/local/lib/php to your php.ini include_path
    /root/php-7.0.9/build/shtool install -c ext/phar/phar.phar /usr/local/bin
    ln -s -f phar.phar /usr/local/bin/phar
    Installing PDO headers: /usr/local/include/php/ext/pdo/

    到这里,PHP已经安装成功了。

    关于如何配置PHP,请参考PHP的官方文档。

    Nginx+PHP: http://php.net/manual/zh/install.unix.nginx.php

    Nginx和PHP配置完成之后,创建测试文件:

    echo "<?php phpinfo(); ?>" >> /usr/local/nginx/html/index.php

    访问http://localhost/index.php,如果可以将phpinfo打印到屏幕上,就证明 Nginx 和 PHP 配置正确。

    如果您觉得阅读本文对您有帮助,欢迎转载本文,但是转载文章之后必须在文章页面明显位置保留此段声明,否则保留追究法律责任的权利。

    作  者:blog.jpdou.top

    原文链接:http://blog.jpdou.top/install-php7-from-source/

  • 相关阅读:
    【字符编码】字符编码 && Base64编码算法
    【JVM】JVM系列之执行引擎(五)
    【JVM】JVM系列之类加载机制(四)
    【JVM】JVM系列之Class文件(三)
    【知识积累】DES算法之C#加密&Java解密
    appium多机并行测试
    Jenkins 传递自定义的参数
    python对ftp进行操作
    Linux下ftp服务器搭建
    appium +ios 判断元素是否存在,排除visible=“false”的数据
  • 原文地址:https://www.cnblogs.com/jpdoutop/p/5745236.html
Copyright © 2011-2022 走看看