make # make install # make clean d.安装 zlib # cd /root/Software/ # tar –zxvf zlib-1.2.3.tar.gz # cd zlib.1.2.3 # mkdir /usr/local/zlib # ./configure –prefix=/usr/local/zlib # make # make install # make clean e.安装 gettext # cd /opt/soft / # tar –zxvf gettext-0.14.5.tar.gz # cd gettext-0.14.5 # ./configure –prefix=/usr/local/gettext # make # make install # make clean f.安装 libxml # cd /opt/soft / # tar –zxvf lib
xml-1.8.17.tar.gz # cd libxml-1.8.17 # ./configure –prefix=/usr/local/libxml # make
# make install # make clean g.安装 gdbm # cd /opt/soft / # tar –zxvf gdbm-1.8.2.tar.gz # cd gdbm-1.8.2 # ./configure –prefix=/usr/local/gdbm # make # make install # make clean h.安装 libiconv # cd /opt/soft / # tar –zxvf libiconv-1.10.tar.gz # cd libiconv-1.10 # ./configure –prefix=/usr/local/libiconv # make # make install # make clean i.安装 gd2 # cd /opt/soft / # tar –zxvf gd-2.0.33.tar.gz # cd gd-2.0.33 # ./configure –prefix=/usr/local/gd2 –with-zlib=/usr/local/zlib/ --with-png=/usr/local/libpng/ --with-jpeg=/usr/local/jpeg/ --with-freetype=/usr/local/freetype # make # make install # make clean
第三步 安装 PHP
# cd /opt/soft / # tar –zxvf php-5.0.5
.tar.gz # cd php-5.0.5.tar.gz
./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache/bin/apxs –with-jpeg-dir=/usr/local/jpeg/ --with-gettext –enable-mbstring –with-libxml-dir=/usr/local/libxml –with-png-dir=/usr/local/libpng/ --with-gd=/usr/local/gd2/ --with-freetype-dir=/usr/local/freetype –enable-trace-vars –with-zlib-dir=/usr/local/zlib/ --with-mysql=/usr/local/mysql –with-gdbm-dir=/usr/local/gdbm/ --enable-wddx --with-iconv –enable-sockets –disable-ipv6
#
# make
# make install # make clean
# cp php.ini-dist /usr/local/php/lib/php.ini
第四步 修改 httpd.conf 文件
编辑 apache 配置文件 httpd.conf #vi /usr/local/apache2/conf/httpd.conf 要改的有如下几处: 1 一般都在 #AddType application/x-tar .tgz 下加一行 #LoadModule php5_module modules/libphp5.so AddType application/x-httpd-php .php 如果
搜索其它地方没有以下这行 LoadModule php5_module modules/libphp5.so 把上面的#号去掉 2 找到 DirectoryIndex index.html index.html.var 在后面加 index.php 让它把 index.php 做为默认页 3 #ServerName 把#去掉,后面的 IP 改成本机的 IP.
第五步 测试
在 apache 的根目录下面(/usr/local/apache/htdocs)建立一个文件内容为: 保存为 test.php 文件 然后重启 apache 服务器,进行如下操作 #/usr/local/apache/bin/apachectl –k stop #/usr/local/apache/bin/apachectl –k start
然后在地址栏里面输入: 本机 IP/test.php 如果可以看到 php 的版本以及其他相关 信息就说明 PHP 已经安装成功了
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
安装 me