3、PHP的安裝
安裝GD庫(讓PHP支援GIF,PNG,JPEG)
首先下載下傳 jpeg6,libpng,freetype 并安裝子產品
wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
wget http://nchc.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.8.tar.gz
wget http://nchc.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.9.tar.gz
wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
安裝 jpeg6
建立目錄
# mkdir /usr/local/jpeg6
# mkdir /usr/local/jpeg6/bin
# mkdir /usr/local/jpeg6/lib
# mkdir /usr/local/jpeg6/include
# mkdir /usr/local/jpeg6/man
# mkdir /usr/local/jpeg6/man/man1
# cd /tmp
# tar -zxf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
# make; make install
安裝libpng
# tar -zxf libpng-1.2.8.tar.gz
# cd libpng-1.2.8
# cp scrīpts/makefile.std makefile
安裝 freetype
# cd /root/soft
# tar -zxf freetype-2.1.10.tar.gz
# cd freetype-2.1.10
# ./configure --prefix=/usr/local/freetype
# make;make install
安裝最新的GD庫
# tar -zxf gd-2.0.33.tar.gz
# cd gd-2.0.33
# ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6/ --with-png --with-zlib --with-freetype=/usr/local/freetype/
由于php5需libxml2的支援, 是以先下載下傳并安裝libxml2
# wget http://ftp.gnome.org/pub/gnome/sources/libxml2/2.6/libxml2-2.6.30.tar.gz
# tar -zxf libxml2-2.6.19.tar.gz
# cd libxml2-2.6.19
# ./configure --prefix=/usr/local/libxml2
安裝 libxslt
# wget http://ftp.gnome.org/pub/gnome/sources/libxslt/1.1/libxslt-1.1.22.tar.gz
# tar -zxf libxslt-1.1.22.tar.gz
# cd libxslt-1.1.22
# ./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2
終于要安裝PHP了:
# tar -zxf php-5.2.3.tar.gz
# cd php-5.2.3
# ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --enable-ftp --with-libxml-dir=/usr/local/libxml2 --with-expat-dir=/usr/lib --with-xsl=/usr/local/libxslt --enable-xslt --with-gd=/usr/local/gd2/ --with-jpeg-dir=/usr/local/jpeg6/ --with-zlib-dir=/usr/lib --with-png --with-freetype-dir=/usr/local/freetype --enable-mbstring
# make
# make install
其中./configure 後的
--prefix=/usr/local/php5
--with-apxs2=/usr/local/apache/bin/apxs
--with-mysql=/usr/local/mysql/
--with-libxml-dir=/usr/local/libxml2
是必要的選項
--with-gd=/usr/local/gd2/
--with-jpeg-dir=/usr/local/jpeg6/
--with-png
--with-zlib-dir=/usr/lib
--with-freetype-dir=/usr/local/freetype
這是讓PHP支援GD庫的配置選項
配置 httpd.conf 讓apache支援PHP
# vi /usr/local/apache/conf/httpd.conf
找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps在你Web目錄裡建一内容為 PHP檔案, 輸入URL位址檢視PHP配置是否正确
安裝 phpmyadmin
下載下傳
# tar zxvf phpMyAdmin-2.11.2-all-languages.tar.gz
# mv phpMyAdmin-2.11.2-all-languages /usr/local/httpd/htdocs/phpmyadmin
# cd /usr/local/httpd/htdocs/phpmyadmin
# cp ./libraries/config.default.php ./config.inc.php
#vi config.inc.php
$cfg['PmaAbsoluteUri'] = 'http://localhost/phpmyadmin';
$cfg['Servers'][$i]['auth_type'] = 'http';
安裝zend:
# tar zxvf ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz
# cd ZendOptimizer-3.2.2-linux-glibc21
# ./install.sh
OK,CentOS下LAMP安裝成功~!