php环境
下载地址:http://museum.php.net/php5/php-5.2.16.tar.gz
http://down1.chinaunix.net/distfiles/libxml2-2.6.30.tar.gz
http://prdownloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz
http://sourceforge.net/projects/libpng/files/zlib/1.2.3/zlib-1.2.3.tar.gz
http://down1.chinaunix.net/distfiles/gd-2.0.32.tar.gz
http://down1.chinaunix.net/distfiles/autoconf-2.63.tar.gz
http://download.savannah.gnu.org/releases/freetype/freetype-2.3.5.tar.gz
http://sourceforge.net/projects/libpng/files/libpng15/1.5.6/libpng-1.5.6.tar.gz
http://www.imagemagick.org/download/delegates/jpegsrc.v7.tar.gz
http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz
# tar zxvf libxml2-2.6.30.tar.gz
# cd libxml2-2.6.30
# ./configure --prefix=/usr/local/libxml2
# make && make install
# tar zxvf libmcrypt-2.5.8.tar.gz
# cd libmcrypt-2.5.8
# ./configure --prefix=/usr/local/libmcrypt
# make && make install
# cd /usr/src/libmcrypt-2.5.8/libltdl
# ./configure --enable-ltdl-install
# make && make install
# tar zxvf libpng-1.2.31.tar.gz
# cd libpng-1.2.31
# ./configure --prefix=/usr/local/libpng
# make && make install
安装GD2库前所需的jpeg6库文件,需要自己手动地创建安装需要的目录,它们在安装时不能自动创建。
# mkdir /usr/local/jpeg7 //建立jpeg6软件安装目录
# mkdir /usr/local/jpeg7/bin //建立存放命令的目录
# mkdir /usr/local/jpeg7/lib //创建jpeg6库文件所在目录
# mkdir /usr/local/jpeg7/include //建立存放头文件目录
# mkdir -p /usr/local/jpeg7/man/man1 //建立存放手册的目录
# tar zxvf jpegsrc.v7.tar.gz
# cd jpeg-v7
# ./configure --prefix=/usr/local/jpeg7 --enable-shared --enable-static
注:
--enable-shared //建立共享库使用的GNU的libtool
--enable-static //建立静态库使用的GNU的libtool
# make && make install
# tar zxvf freetype-2.3.5.tar.gz
# cd freetype-2.3.5
# ./configure --prefix=/usr/local/freetype
# make clean
# make && make install
# tar zxvf autoconf-2.61.tar.gz
# cd autoconf-2.61
# ./configure
# make && make install
# tar zxvf libiconv-1.13.tar.gz
# cd libiconv-1.13/
# ./configure --prefix=/usr/local/libiconv
# make && make install
# tar xzf gettext-0.17.tar.gz
# cd gettext-0.17
# ./configure
# make && make install
# tar zxvf gd-2.0.35.tar.gz
# cd gd-2.0.35
# vi gd_png.c
# include "/usr/local/libpng/include/png.h"
:wq
# ./configure --prefix=/usr/local/gd2 --with-zlib=/usr/local/zlib --with-jpeg=/usr/local/jpeg7 -
-with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --enable-m4_pattern_allow
# make && make install
# make clean
# make && make install
# vi /usr/local/apache/conf/httpd.conf
AddType application/x-httpd-php .php
DirectoryIndex index.php index.html
:wq
# tar zxvf php-5.2.16.tar.gz
# cd php-5.2.16
# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-
apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-
mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir=/usr/local/libxml2 --with-png-
dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg7 --with-freetype-dir=/usr/local/freetype -
-with-gd=/usr/local/gd2 --with-zlib-dir=/usr/local --with-mcrypt=/usr/local/libmcrypt --enable-
soap --enable-mbstring=all --enable-sockets
# make && make install
# cp php.ini-dist /usr/local/php/etc/php.ini
# cd /usr/local/php/etc
# cp php.ini php.ini.bak
# grep -v ";" php.ini.bak > php.ini
# vi /usr/local/php/etc/php.ini
extension_dir="/usr/lib/php/modules" (原为extension_dir="./" )
:wq
# cd /usr/src/php-5.2.16/ext/mcrypt
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config --with-mcrypt=/usr/local/libmcrypt
# make && make install
# cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/mcrypt.so
/usr/lib/php/modules
# vi /usr/local/php/etc/php.ini
[mcrypt]
extension=mcrypt.so
:wq
# setenforce 0
# chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t /usr/local/apache/modules/libphp5.so
# chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t /usr/lib/php/modules/mcrypt.so
# /usr/local/apache/bin/apachectl restart
# setenforce 1
测试:
# vi /usr/local/apache/htdocs/test.php
<?php
phpinfo();
?>
:wq
# /usr/local/apache/bin/apachectl restart
访问:http://www.benet.com/test.php