Linux安裝php-7.0.16,完成php和apache的配置____Linux

來源:互聯網
上載者:User

Linux安裝php-7.0.16,完成php和apache的配置



版本:php-7.0.16.tar.gz,libxml2-2.9.2.tar.gz(php需要它的支援,首先安裝它)


說明 :接上一篇安裝apache的部落格,完成php和apache的配置,上一篇部落格地址:http://blog.csdn.net/forrest_ou/article/details/60769087


libxml2下載地址:www.xmlsoft.org



libxml2-2.9.2.tar.gz的安裝過程中,出現了兩個關於python的錯誤,因為我沒有用到它,就先把他放那裡了,仍然安裝在opt/daas/LAPW檔案夾中


php下載地址:www.xmlsoft.org







安裝php-7.0.16.tar.gz


第三步:解壓,兩次操作  gzip -d  php-7.0.16.tar.gz
                                          tar -xf  php-7.0.16.tar
              檔案夾中多了php-7.0.16這個檔案夾


第四步:安裝,cd php-7.0.16,進入php-7.0.16檔案夾,然後執行以下命令
                        ./configure -prefix=/opt/daas/LAPW/php7 --with-libxml-dir=/opt/daas/LAPW/libxml2 

                         --with-apxs2=/opt/daas/LAPW/apache/bin/apxs
                         make
                         make intall
              說明: -prefix=/opt/daas/LAPW/php7指定安裝目錄,安裝到LAPW檔案夾下的php7檔案夾
                         --with-libxml-dir=/opt/daas/LAPW/libxml2 --with-apxs2=/opt/daas/LAPW/apache/bin/apxs指定依賴



第五步:測試是否安裝成功,測試之前配置httpd.conf(apache/conf/httpd.conf),在httpd.conf中修改配置如下
               搜尋LoadModule,在後面添加:LoadModule php7_module modules/libphp7.so(不添加,會出現運行php                檔案變成下載)。後面緊跟著添加:
               <FilesMatch "\.ph(p[2-6]?|tml)$">
                       SetHandler application/x-httpd-phpAddType application/x-compress .Z
                       AddType application/x-gzip .gz .tgz
               </FilesMatch>
               搜尋DirectoryIndex,在後面添加index.php index.phtml
               找到
               AddType application/x-compress .Z
   
               AddType application/x-gzip .gz .tgz
               在後面添加
               AddType application/x-httpd-php .php

               AddType application/x-httpd-php-source .php7
               以上httpd.conf檔案修改完畢
               添加測試檔案phpinfo.php到apache/htdocs目錄下
               phpinfo.php的內容:
               <?php
                   phpinfo();
               ?>
              重啟apache,在瀏覽器輸入之前測試apache的路徑後面加上/phpinfo.php,出現php的頁面即安裝成功


聯繫我們

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