下載安裝包:wget http://cn2.php.net/distributions/php-5.6.29.tar.gz

php編譯安裝步驟:
一,配置編譯參數(shù)./configure
./configure \
>--prefix=/usr/local/php \
>--with-apxs2=/usr/local/apache2/bin/apxs \ //安裝該參數(shù)后會(huì)出現(xiàn)php_module模塊
>--with-config-file-path=/usr/local/php/etc \
>--with-mysql=/usr/local/mysql \
>--with-libxml-dir \
>--with-gd
>--with-jpeg-dir \
>--with-png-dir \
>--with-freetype-dir \
>--with-iconv-dir \
>--with-zlib-dir \
>--with-bz2 \
>--with-openssl \
>--with-mcrypt \
>--enable-soap \
>--enable-gd-native-ttf \
>--enable-mbstring \
>--enable-sockets \
>--enable-exif \
>--disable-ipv6
./configure編譯之后遇到的一些錯(cuò)誤信息:
1.configure: error: Cannot find OpenSSL's <evp.h>
解決方法:yum install -y openssl openssl-devel
2.checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
解決方法:yum install -y bzip2 bzip2-devel
3.configure: error: jpeglib.h not found.
解決方法:yum install -y libjpeg-turbo libjpeg-turbo-devel
4.configure: error: png.h not found.
解決方法:yum install -y libpng libpng-devel
5.configure: error: freetype-config not found.
解決方法:yum install -y freetype freetype-devel
6.configure: error: mcrypt.h not found. Please reinstall libmcrypt.
解決方法:yum install -y epel-release
yum install -y libmcrypt-devel
(因?yàn)镃entos默認(rèn)的yum源沒有l(wèi)ibmcrypt-devel這個(gè)包,只能借epel的yum源)
7.checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
解決方法:yum install -y libxml2-devel
二,編譯make
三,安裝make install
安裝完成后,還不能使用,還需要進(jìn)一步配置一下
拷貝php配置文件:(在./configure配置參數(shù)時(shí)的目錄下)
cp php.ini-production /usr/local/php/etc/php.ini
(這一步必須得有,要不然后面不能正常解析php文件)

修改apache配置文件
vi /usr/local/apache2/conf/httpd.conf
1.找到:
<Directory "/usr/local/apache2//cgi-bin">
AllowOverride None
Options None
Order allow,deny
Denyfrom all
</Directory>
改為:
<Directory "/usr/local/apache2//cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allowfrom all
</Directory>
說(shuō)明:如果不修改這個(gè)地方,我們?cè)L問(wèn)網(wǎng)站會(huì)禁止訪問(wèn),顯示403
2.找到: AddType application/x-gzip .gz .tgz
在該行下面添加: AddType application/x-httpd-php .php
說(shuō)明:要想支持PHP腳本解析,必須要加上對(duì)應(yīng)的類型
3.找到:
<IfModule dir_module>
DirectoryIndex index.html index.htm
</IfModule>
改為:
<IfModule dir_module>
DirectoryIndex index.html index.htmindex.php
</IfModule>
說(shuō)明:增加針對(duì)php的索引,如果一個(gè)站點(diǎn)默認(rèn)頁(yè)為index.php,那么就得加上這個(gè)index.php的支持。
4.找到:
#ServerName www.example.com:80
改為:
ServerName localhost:80
說(shuō)明:如果不去掉#,啟動(dòng)apache時(shí),會(huì)有警告信息
5.去掉/user/local/apache2/conf/httpd.conf里#Include conf/extra/httpd-vhosts.conf的井號(hào),解析localhost下的php提示404.
原因:/usr/local/apache2/confhttpd.conf下的php文件在doucmentroot=/usr/local/apache2/htdocs下;而/usr/local/apache2/conf/extra/httpd-vhosts.conf下的php文件在doucmentroot=/data/www下。兩個(gè)路徑不一樣所以不能通用php文件
6.要想使用curl localhost/1.php:要開啟httpd服務(wù),該命令才可以使用
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
本文標(biāo)題:LAMP中的php編譯安裝-創(chuàng)新互聯(lián)
網(wǎng)址分享:http://www.yijiale78.com/article36/docosg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供動(dòng)態(tài)網(wǎng)站、網(wǎng)站收錄、App開發(fā)、網(wǎng)站制作、關(guān)鍵詞優(yōu)化、標(biāo)簽優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容