步骤三:安装apache(这个,因为当初安装redhat的时候,已经安装了apache,本来想跳过去,不再安装的,可惜后面遇到问题了,不得已,先卸载旧版本,再安装最新版本:
后面安装php遇到的问题:
Sorry, I cannot run apxs. Possible reasons follow:
1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)
开始因为确认perl已经安装,偶就以为是什么apxs的问题,找了一堆自己也看不懂的文章、论坛,慢慢摸索,有了点线索:
apxs是一个为Apache HTTP服务器编译和安装扩展模块的工具,用于编译一个或多个源程序或目标代码文件为动态共享对象,使之可以用由mod_so提供的LoadModule指令在运行时加载到Apache服务器中。
因此,要使用这个扩展机制,你的平台必须支持DSO特性,而且Apache httpd必须内建了mod_so模块。apxs工具能自动探测是否具备这样的条件,你也可以自己用这个命令手动探测:
$ httpd -l 可惜的是,偶执行httpd -l后,发现存在mod_so:
[iyunv@redhat php-5.2.2]# httpd -l
Compiled in modules:
core.c
prefork.c
http_core.c
mod_so.c
怎么办?因为不知道redhat当初怎么装的apache,算了卸载,俺自己装一遍:
哪里知道,卸载又有问题了:
执行:rpm -e httpd,结果:
[iyunv@redhat root]# rpm -e httpd
error: Failed dependencies:
httpd-mmn = 20020628 is needed by (installed) mod_perl-1.99_07-5
httpd-mmn = 20020628 is needed by (installed) mod_python-3.0.1-3
httpd-mmn = 20020628 is needed by (installed) mod_ssl-2.0.40-21
httpd-mmn = 20020628 is needed by (installed) php-4.2.2-17
libapr.so.0 is needed by (installed) mod_perl-1.99_07-5
libaprutil.so.0 is needed by (installed) mod_perl-1.99_07-5
webserver is needed by (installed) webalizer-2.01_10-11
httpd >= 2.0.40 is needed by (installed) mod_perl-1.99_07-5
httpd >= 2.0.40 is needed by (installed) mod_python-3.0.1-3
httpd is needed by (installed) mod_ssl-2.0.40-21
httpd is needed by (installed) redhat-config-httpd-1.0.1-18
继续找资料,原来如此:
[iyunv@redhat root]# rpm -qa|grep httpd
httpd-manual-2.0.40-21
httpd-2.0.40-21
redhat-config-httpd-1.0.1-18
然后一个一个卸载掉:
[iyunv@redhat root]# rpm -e httpd-manual-2.0.40-21
[iyunv@redhat root]# rpm -e redhat-config-httpd-1.0.1-18
warning: /etc/alchemist/namespace/apache/local.adl saved as /etc/alchemist/namespace/apache/local.adl.rpmsave
[iyunv@redhat root]# rpm -e httpd-2.0.40-21
error: Failed dependencies:
httpd-mmn = 20020628 is needed by (installed) mod_perl-1.99_07-5
httpd-mmn = 20020628 is needed by (installed) mod_python-3.0.1-3
httpd-mmn = 20020628 is needed by (installed) mod_ssl-2.0.40-21
httpd-mmn = 20020628 is needed by (installed) php-4.2.2-17
libapr.so.0 is needed by (installed) mod_perl-1.99_07-5
libaprutil.so.0 is needed by (installed) mod_perl-1.99_07-5
webserver is needed by (installed) webalizer-2.01_10-11
httpd >= 2.0.40 is needed by (installed) mod_perl-1.99_07-5
httpd >= 2.0.40 is needed by (installed) mod_python-3.0.1-3
httpd is needed by (installed) mod_ssl-2.0.40-21
httpd is needed by (installed) redhat-config-httpd-1.0.1-18
还是有一个没有卸载掉,how to?继续找资料,原来……太狠了,将所有的依存的服务也卸载掉:
[iyunv@redhat root]# rpm -e mod_perl-1.99_07-5
[iyunv@redhat root]# rpm -e mod_python-3.0.1-3
[iyunv@redhat root]# rpm -e mod_ssl-2.0.40-21
[iyunv@redhat root]# rpm -e webalizer-2.01_10-11
[iyunv@redhat root]# rpm -e httpd-2.0.40-21
warning: /etc/httpd/conf/httpd.conf saved as /etc/httpd/conf/httpd.conf.rpmsave ok,卸载成功,不急,卸载过程中,发现redhat已经安装过php环境,晕,不过为了学习php安装,咱也将其卸载掉,过程如下:
[iyunv@redhat root]# rpm -qa|grep php
php-ldap-4.2.2-17
php-imap-4.2.2-17
php-4.2.2-17
[iyunv@redhat root]# rpm -e php-ldap-4.2.2-17
[iyunv@redhat root]# rpm -e php-imap-4.2.2-17
[iyunv@redhat root]# rpm -e php-4.2.2-17
[iyunv@redhat root]# whereis php
php:
然后重新安装apache。
)
前面的步骤很无奈,不过学会了卸载rpm的安装包,值!
版本:httpd-2.2.4.tar.gz
下载地址:http://www.apache.org
1、tar xzvf httpd-2.2.4.tar.gz
2、mv httpd-2.2.4 /usr/local/src
3、cd /usr/local/src/,执行:configure --prefix=/etc/httpd --enable-module=so (为了不必每次configure都要执行./configure,可以在环境变量中,添加当前路径:vi /root/.bash_profile,修改PATH=xxxx:.(就是添加一个冒号和点号))
4、执行:make
5、执行:make install
6、启动服务:/etc/httpd/bin/apachectl start,这里会有提示:没有域名之类的信息,可以到:vi /etc/httpd/conf/httpd.conf,修改ServerName 10.0.0.x:80即可
7、为了便于在webmin这类管理工具管理apache,可以:cp /etc/httpd/bin/httpd /usr/sbin/ ok,apache安装大功告成!