安裝PHP7.1+apache2.4.23

來源:互聯網
上載者:User

標籤:沒有   安裝php7   ber   測試   info   native   解析   .com   net   

安裝準備: http://ftp.cuhk.edu.hk/pub/packages/apache.org//httpd/httpd-2.4.23.tar.gz 下載apachehttp://cn2.php.net/distributions/php-7.1.0.tar.gz  下載php7.1http://archive.apache.org/dist/apr/apr-1.5.0.tar.gz 下載apr

http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz 下載apr-util

http://jaist.dl.sourceforge.net/project/pcre/pcre/8.39/pcre-8.39.tar.gz  下載pcre注意事項:wget  vim   gcc gcc-c++   cmake  這幾個也是安裝 Apache 所需要的小環境 。  yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel mysql pcre-devel curl-devel  libxslt-devel 
yum install gcc-c++ gcc 首先安裝apr先解壓(略)./configure --prefix=/usr/local/apr/
make && make install 安裝apr-util (PS:注意先後順序)先解壓(略) ./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/  make && make install 安裝pcre先解壓(略)  ./configure --prefix=/usr/local/pcre/  
make && make install 然後安裝apache

先解壓(略)

 ./configure --prefix=/usr/local/apache/ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/  
make && make install 安裝完成 測試apache cd /usr/local/apache/bin/  ./apachectl start   啟動apache 成功顯示 It Works!就代表 伺服器已成功!添加Apache到Linux服務

cp /usr/local/apache/bin/apachectl  /etc/rc.d/init.d/

mv /etc/rc.d/init.d/apachectl /etc/rc.d/init.d/httpd

chkconfig --add httpd  #所有開機模式下自啟動

chkconfig httpd on  #345開機模式下自啟動

 

安裝php7
先解壓(略)./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 出現“/replace/with/path/to/perl/interpreter: bad interpreter: No such file or 

#vi  /usr/local/apache/bin/apxs

第一行的#!/replace/with/path/to/perl/interpreter -w,找到你perl的安裝位置,如果不清楚,可以用which perl找到,一般在/usr/bin/perl ,於是將第一行改為:#!/usr/bin/perl -w. 再運行php的configure, 一切正常!

 make && make install  安裝完成後開啟httpd.conf  尋找php7

看是否搜尋到:LoadModule php7_module modules/libphp7.so

如果沒有搜尋到(一般都是可以搜尋到的),就將這段指令添加到httpd.conf設定檔中,使apache可以載入libphp7.so模組,並進行php檔案的解析。

:wq

進行儲存退出。

 

cd  /usr/local/apache/htdocs

按 i 鍵進入編輯模式,添加:

<?php

     phpinfo();

?>

按Esc鍵回到命令模式,儲存退出:

:wq

 

安裝PHP7.1+apache2.4.23

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.