启动http服务,遇到的错误。


1、没有关闭SELINUX引起的。

[root@localhost etc]# /usr/local/apache2/bin/apachectl start

httpd: Syntax error on line 99 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/mysql/lib/libmysqlclient.so.16: cannot restore segment prot after reloc: Permission denied


解决:setenforce 0

[root@localhost etc]# setenforce 0

[root@localhost etc]# getenforce

Permissive



2、没有在/etc/httpd/conf/httpd.conf 中设定ServerName 

[root@localhost etc]# /usr/local/apache2/bin/apachectl start

httpd: apr_sockaddr_info_get() failed for tongyl

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName


解决:

[root@localhost etc]# vi /usr/local/apache2/conf/httpd.conf

找到#ServerName www.example.com:80   把#去掉,再重启apache即可没事了。


结果:

[root@localhost etc]# /usr/local/apache2/bin/apachectl start

httpd (pid 16288) already running