在CentOS7上源碼安裝php7

來源:互聯網
上載者:User

標籤:

Install php7 on CentOSInstall from source

首先下載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.tar.gz

然後開始./configrue

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

configure過程中可能會出現的問題:

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

解決辦法:

# rpm -qa|grep libxml2libxml2-python-2.9.1-5.el7_1.2.x86_64libxml2-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

經過“漫長”的等待後,編譯完成

Generating phar.phpGenerating phar.pharPEAR package PHP_Archive not installed: generated phar will require PHP‘s phar extension be enabled.directorytreeiterator.incpharcommand.incdirectorygraphiterator.incinvertedregexiterator.incclicommand.incphar.incBuild 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: phpizeprogram: php-configInstalling man pages: /usr/local/php/man/man1/page: phpize.1page: php-config.1Installing 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.1Wrote PEAR system config file at: /usr/local/etc/pear.confYou 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/binln -s -f phar.phar /usr/local/bin/pharInstalling PDO headers: /usr/local/include/php/ext/pdo/

其餘步驟參考http://php.net/manual/zh/install.unix.nginx.php 建立測試檔案:

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

 

在CentOS7上源碼安裝php7

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.