您好,登錄后才能下訂單哦!
Centos6.2安裝PHP
1;安裝Php程序環(huán)境
1,1 php是依賴apache和mysql的,所以先要檢查apache及mysql的安裝情況
首先檢查apache和mysql是否安裝 查看服務(wù)器是否起來 是否運(yùn)行正常
這里有個重點(diǎn),以后不管在哪臺服務(wù)器上安裝php都需要在這臺服務(wù)器上先安裝mysql,這樣才能連接遠(yuǎn)程的數(shù)mysql數(shù)據(jù)庫
1,2 查看以前是否安裝過php
[root@taoke1 mysql]# rpm -qa |grep php
如果安裝過需要先卸載php
[root@taoke1 mysql]# rpm -e --nodeps php
2;安裝php所依賴的庫文件包
2,1安裝freetype
[root@taoke1 ~]# tar jxvf freetype-2.3.10.tar.bz2
[root@taoke1 ~]# cd freetype-2.3.10
[root@taoke1 freetype-2.3.10]# ./configure --prefix=/usr/local/freetype
[root@taoke1 freetype-2.3.10]# make && make install
2,2安裝jpeg
[root@taoke1 ~]# tar -xzvf jpegsrc.v7.tar.gz
[root@taoke1 ~]# cd jpeg-7/
[root@taoke1 jpeg-7]# ./configure --prefix=/usr/local/jpeg
[root@taoke1 jpeg-7]# make && make install
2,3安裝libpng
[root@taoke1 ~]# tar jvxf libpng-1.2.41.tar.bz2
[root@taoke1 ~]# cd libpng-1.2.41
[root@taoke1 libpng-1.2.41]# make && make install
2,3安裝libiconv
[root@taoke1 ~]# tar -zxvf libiconv-1.14.tar.gz
[root@taoke1 ~]# cd libiconv-1.14
[root@taoke1 libiconv-1.14]# ./configure --prefix=/usr/local/libiconv
[root@taoke1 libiconv-1.14]# make && make install
2,4安裝GD
2,4,1檢測/usr/include下是否有鏈接頭文件pngconf.h png.h
[root@taoke1 include]# ln -s /usr/local/libpng/include/pngconf.h /usr/include
[root@taoke1 include]# ln -s /usr/local/libpng/include/png.h /usr/include
2,4,2安裝GD
[root@taoke1 ~]# tar -xzvf gd-2.0.33.tar.gz
[root@taoke1 ~]# cd gd-2.0.33
[root@taoke1 gd-2.0.33]# ./configure --prefix=/usr/local/gd2 --with-freetype=/usr/local/freetype --with-png=/usr/local/libpng --with-jpeg=/usr/local/jpeg
[root@taoke1 gd-2.0.33]# make && make install
2,5安裝 libmcrypt
[root@taoke1 ~]# tar -xzvf libmcrypt-2.5.7.tar.gz
[root@taoke1 ~]# cd libmcrypt-2.5.7
[root@taoke1 libmcrypt-2.5.7]# ./configure
[root@taoke1 libmcrypt-2.5.7]# make && make install
3;安裝php包 備注:我編譯php5.5.X或者5.6.0的php老是提示gd庫版本低,無奈換了個低版本的源碼包
[root@taoke1 ~]# tar -xzvf php-5.4.13.tar.gz
[root@taoke1 ~]# cd php-5.4.13
./configure \
--prefix=/usr/local/php \
--with-gd=/usr/local/gd2 \
--with-apxs2=/usr/local/apache/bin/apxs \
--enable-mbregex \
--enable-bcmath \
--with-mysql=/usr/local/mysql \
--with-zlib-dir \
--enable-mbstring=all \
--with-pdo-mysql \
--with-freetype-dir=/usr/local/freetype \
--with-jpeg-dir=/usr/local/jpeg \
--with-openssl \
--with-curl \
--disable-fileinfo 【內(nèi)存小于1G用這個參數(shù)】
安裝
[root@taoke1 php-5.4.13]# make ZEND_EXTRA_LIBS='-liconv'
[root@taoke1 php-5.4.13]# make install
4;修改php配置文件
[root@taoke1 php-5.4.13]# cp php.ini-production /etc/php.ini
4,1 vi /etc/php.ini #編輯
date.timezone = PRC #在946行 把前面的分號去掉,改為date.timezone = PRC
disable_functions =
4,2;編輯httpd.conf 添加index.php
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
4,3在AddType中添加兩行
AddType application/x-httpd-php .php .php3 .phtml .inc
AddType application/x-httpd-php-source .phps
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。