lamp環境只編譯安裝php

2021-07-04 14:18:36 字數 835 閱讀 4077

linux上yum安裝apache和mysql的源更新都較快,但php版本往往比較低。所以往往有需求yum安裝apache和mysql,然後編譯安裝php。這個思路就在於不使用yum安裝php,需要手動指定apxs的路徑。

補充知識:apxs是乙個為apache http伺服器編譯和安裝擴充套件模組的工具,用於編譯乙個或多個源程式或目標**檔案為動態共享物件,使之可以用由mod_so提供的loadmodule指令在執行時載入到apache伺服器中。

下面說一下安裝步驟:

1,先安裝apache

yum install mod_ssl openssl openssl-devel
yum install httpd
2,安裝apxs,只要安裝httpd-devel這個軟體包,就會有apxs了。

yum install httpd-devel –y
安裝後apxs的位置在/usr/bin/或者/usr/sbin/下,可以使用以下命令查詢:

whereis apxs
3,編譯安裝php時,configure加上--with-apxs2=/usr/bin/apxs。編譯安裝php請點此:

4,在apache的配置檔案,即/etc/httpd/conf/httpd.conf中,加入對php的支援

同時對目錄的訪問預設首頁加上php

#directoryindex index.html 

directoryindex index.html index.php

然後重啟httpd即可。

編譯LAMP 環境之PHP

版本php 5.3.27 configure 引數全摘自 跟阿銘一起學linux第二版 1.root kaka php 5.3.27 configure prefix usr local php with apxs2 usr local apache2 bin apxs with config fi...

手動編譯安裝lamp之php

馬哥教育講課文件 三 編譯安裝php 5.4.8 1 解決依賴關係 請配置好yum源 可以是本地系統光碟 後執行如下命令 yum y groupinstall x software development libmcrypt 2.5.7 5.el5.i386.rpm libmcrypt devel ...

編譯安裝lamp

1,停止防火牆及不必要的服務 etc init.d rpcbind stop etc init.d cups stop etc init.d postfix stop etc init.d qpidd stop etc init.d nfslock stop chkconfig rpcbind of...