tar zvxf php-5.2.10.tar.bz2
cd php-5.2.10
(1)./configure \
–prefix=/usr/local/php \
–with-MySQL=/usr/local/mysql \
–enable-force-cgi-redirect \
–with-freetype-dir=/usr \
–with-png-dir=/usr \
–with-gd –enable-gd-native-ttf \
–with-ttf \
–with-gdbm \
–with-gettext \
–with-iconv \
–with-jpeg-dir=/usr \
–with-png \
–with-zlib \
–with-xml \
–enable-calendar \
–with-apxs=/usr/local/apache/bin/apxs
(2)make
(3)make install
#我这里由于服务器需要用到GD库,所以加了一些支持GD的编译参数,GD直接用了RedHat自带的GD库,大家没有安装的话可以从安装盘安装,注意除了安装GD以外,还要安装libjpeg,libpng等库文件。另外–with-mysql=/usr/local/mysql指向你安装mysql的路径。–with-apxs指向apache的apxs文件的路径。
vi /usr/local/apache/conf/httpd.conf
查找
在此范围添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
然CPOPY PHP的配置文件
cp ../php-5.2.10/php.ini.dist /usr/local/php/lib/php.ini
修改php.ini文件
register_globals = On
ok!重新启动一下apache服务器
/usr/local/apache/bin/apachectl restart
然后写个php测试页info.php:内容如下
<?php
phpinfo();
?>
正常的话,应该能看到php的信息了,恭喜你的Apche+Mysql+PHP安装成功。