新聞中心
下載php5.6.9包并解壓
10年的凱里網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開(kāi)發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。成都全網(wǎng)營(yíng)銷推廣的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整凱里建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無(wú)論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)公司從事“凱里網(wǎng)站設(shè)計(jì)”,“凱里網(wǎng)站推廣”以來(lái),每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。
[root@localhost ~]# wget http://cn2.php.net/distributions/php-5.6.9.tar.bz2
[root@localhost ~]# tar xf php-5.6.9.tar.bz2
編譯安裝
我的編譯選項(xiàng)如下
--prefix=/usr/local/php:定義安裝的路徑
--with-MySQL=/usr/local/mysql :指定mysql安裝目錄
--with-mysqli=/usr/local/mysql/bin/mysql_config
--with-openssl:Include OpenSSL support (requires OpenSSL >= 0.9.6)
--enable-mbstring :允許多字節(jié)的字符串支持,這樣可支持中文等字體
--with-freetype-dir: Set the path to FreeType 2 install prefix
--with-jpeg-dir :GD: Set the path to libjpeg install prefix
--with-png-dir :GD: Set the path to libpng install prefix
--with-zlib :--with-zlib=DIR Include ZLIB support (requires zlib >= 1.0.9)
--with-libxml-dir=/usr :得先安裝libxml2
--enable-xml :支持?jǐn)U展標(biāo)記語(yǔ)言
--enable-sockets :支持sockets
--with-apxs2=/usr/local/apache/bin/apxs :構(gòu)建動(dòng)態(tài)模塊2.0支持支持,這里意味著在你的/etc/httpd/httpd.conf中.,如果希望使用fastcgi那么請(qǐng)?zhí)鎿Q為enable-fpm
--with-mcrypt :提供加密支持
--with-config-file-path=/etc :在/etc目錄下生成配置文件/etc/php.ini
--with-config-file-scan-dir=/etc/php.d :在/etc/php.d目錄下有分配置文件
--with-bz2 :支持bz2壓縮
--enable-maintainer-zts:支持線程的模塊,如果使用prefork請(qǐng)不要加入該選項(xiàng),可通過(guò)命令httpd V顯示當(dāng)前加載的模塊
[root@localhost php-5.6.9]#./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts
由于軟件太多,所以先編譯一下試試
謝天謝地,只報(bào)了一個(gè)錯(cuò)誤,有的錯(cuò)誤可以參閱http://www.jb51.net/article/37487.htm這位大哥寫(xiě)的文章
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
下載libmcrypt,yum初始源里面并沒(méi)有,所以去別處下載
下載這四個(gè)包并安裝,如果不想下載,請(qǐng)自己更新163或其他源,親測(cè)http://jingyan.baidu.com/article/d2b1d1027b76c75c7e37d4d0.html可以,更新挺久的,2h左右,最后我的可以yum找到這幾個(gè)包了,如果不想更新源,請(qǐng)按照下面步驟
[root@localhost ~]# wget {ftp://rpmfind.net/linux/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm,ftp://rpmfind.net/linux/epel/6/x86_64/libmcrypt-devel-2.5.8-9.el6.x86_64.rpm}
[root@localhost ~]# wget {ftp://rpmfind.net/linux/epel/6/x86_64/mhash-devel-0.9.9.9-3.el6.x86_64.rpm,ftp://rpmfind.net/linux/epel/6/x86_64/mhash-0.9.9.9-3.el6.x86_64.rpm}
中間可能會(huì)有說(shuō)NOKEY,被我忽略了
再重新編譯下試試,如果最后幾行是create….就是成功了
[root@localhost php-5.6.9]# make&&make install
[root@localhost php-5.6.9]# cp php.ini-production /etc/php.ini
解決與httpd的聯(lián)系,如果啟動(dòng)不了,請(qǐng)把自己的防火墻和selinux關(guān)掉哦
a)在指定行添加 AddType application/x-httpd-php .php .phtml
b)在指定行修改 DirectoryIndex index.html index.php
測(cè)試php是否正常運(yùn)行
修改網(wǎng)頁(yè)主頁(yè)為Index.php,把之前的index.html備份或者刪除
[root@localhost htdocs]# cat index.php
it works!
phpinfo();
?>
具體我不截圖了,很多之前編譯加載的模塊被enabled,可以使用
測(cè)試與mysql的連接
[root@localhost htdocs]# cat index.php
if ($conn)
echo "success!";
else
echo "failure!";
?>
安裝php的xcache3.0(負(fù)責(zé)加速解析php代碼)擴(kuò)展
下載安裝包,編譯安裝
下面這部分,針對(duì)php5.4可用
[root@localhost ~]# wget http://xcache.lighttpd.net/pub/Releases/3.0.1/xcache-3.0.1.tar.gz
[root@localhost ~]# tar xf xcache-3.0.1.tar.gz
[root@localhost ~]# cd xcache-3.0.1
[root@localhost xcache-3.0.1]# /usr/local/php/bin/phpize #phpize是準(zhǔn)備一個(gè)php擴(kuò)展準(zhǔn)備編譯,第一層次的檢查
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
編譯指定哪個(gè)擴(kuò)展(xcache),php-config是負(fù)責(zé)解析這個(gè)擴(kuò)展并編譯的,相當(dāng)于檢閱吧
[root@localhost xcache-3.0.1]# ./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config
[root@localhost xcache-3.0.1]# make&&make install
/root/xcache-3.0.1/xcache.c: In function 'zif_xcache_get_special_value':
/root/xcache-3.0.1/xcache.c:324: error: 'IS_CONSTANT_ARRAY' undeclared (first use in this function)
/root/xcache-3.0.1/xcache.c:324: error: (Each undeclared identifier is reported only once
/root/xcache-3.0.1/xcache.c:324: error: for each function it appears in.)
make: *** [xcache.lo] Error 1
上面的內(nèi)容會(huì)報(bào)錯(cuò),原因是php5.6 xcache3.0并不支持,所以官網(wǎng)下載最新版,所以還是多去官網(wǎng)或權(quán)威網(wǎng)站比較好
[root@localhost ~]# wget http://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz
[root@localhost~]# tar xzf xcache-3.2.0.tar.gz
[root@localhost~]# cd xcache-3.2.0
[[email protected]]# /usr/local/php/bin/phpize
Configuringfor:
PHPApi Version: 20131106
ZendModule Api No: 20131226
ZendExtension Api No: 220131226
[[email protected]]# ./configure --enable-xcache--with-php-config=/usr/local/php/bin/php-config
[[email protected]]#make&&make install
Installingshared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
終于安裝好了,看來(lái)編譯環(huán)境和軟件版本等都需要考慮
把主配置文件放到php的碎片配置小分隊(duì)
[[email protected]]# mkdir /etc/php.d
[[email protected]]# cp xcache.ini /etc/php.d/
修改/etc/php.d/xcache.ini文件中的指定地方
extension= /usr/local/php/lib/php/extensions/no-debug-zts-20131226/xcache.so
重啟服務(wù)
[[email protected]]# service httpd restart
Stoppinghttpd: [ OK ]
Startinghttpd: [ OK ]
再次打開(kāi)網(wǎng)頁(yè)發(fā)現(xiàn)有了這個(gè)模塊支持
文章標(biāo)題:lamp源碼安裝之centos6.5源碼安裝之php5.6.9
本文URL:http://fisionsoft.com.cn/article/podhgj.html