PHP安装
1、为了让php服务支持网站常用的一些项目,安装php之前需要先安装依赖的软件包,确认yum源可用的情况下执行两条命令安装就可以:yum -y install lib* 和yum -y install freetype* 安装即可!
2、安装gd 2.0:
# tar zxvf gd-2.0.33.tar.tar
# cd gd-2.0.33
# ./configure
# make && make install
3、安装freetds,用于连接MySQL数据库:
# tar zxvf freetds-stable0.64.tgz
# cd freetds-0.64
# ./configure --prefix=/usr/local/freetds --enable-msdblib --with-tdsver=8.0 --enable-dbmfix --with-gnu-ld --enable-shared --enable-static
# make && make install
4、安装php:
# tar zxvf php-5.2.5.tar.gz
#cd php-5.2.5
5、编译选项:
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql5/ --with-curl --with-libxml-dir --with-libexpat-dir --enable-soap --with-xsl --with-gd --with-jpeg-dir --with-zlib --with-png-dir --with-freetype-dir --enable-sockets --enable-pcntl --with-mssql=/usr/local/freetds --enable-mbstring
6、编译安装:
# make && make install
7、复制源码包中的配置文件模板:
# cp php.ini-dist /usr/local/php/lib/php.ini
8、修改apache配置文件,增加以下两行:
# sed -i '/AddType application\/x-gzip .gz .tgz/a \
AddType application/x-httpd-php .php\
AddType application/x-httpd-php-source .phps\
' /usr/local/apache/conf/httpd.conf
9、在/usr/local/apache/htdocs目录下建立test.php文件:
# echo –e “<?php phpinfo() ?>” > /usr/local/apache/htdocs/test.php
重启apache服务,在浏览器打开http://ip/test.php,如相关参数正常则php安装成功。

