您的位置:首页 > 运维架构 > Apache

解决Fedora Core 4中Apache无法加载PHP模块的问题

2008-04-04 17:20 801 查看
Fedora Core 2开始就已经有了SELinux (Security-Enhanced Linux )这个东西,不过在 FC2下是默认不打开的,从FC3开始就默认打开了,但是打开了是很安全,但是很多操作也不能操作了。
比如再FC4下装Apache + PHP,手工编译的,但是去无法解析PHP,看错误提示,都是什么:
[root@localhost ~]# /usr/local/apache/bin/apachectl start Syntax error on line 232 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp4.so into server: /usr/local/apache/modules/libphp4.so: cannot restore segment prot after reloc: Permission denied
郁闷了,总是无法加载libphp4.so这个包,想了半天没有结果,搜索一下,原来是SELinux再搞鬼,哼,把你给关了。

使用vi/gedit/kate/bluefish任何的文本编辑工具打开 /etc/selinux/config,找到这段:
找到这段:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=enforcing
把 SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为:
SELINUX=disabled
保存,关闭。

然后再使用文本编辑工具打开:/etc/sysconfig/selinux,找到:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=enforcing
如果SELINUX已经是 SELINUX=disabled,那么就不用改了,否则就把SELINUX=enforcing 注释掉,新加一行:
SELINUX=disabled
保存,退出。
重启系统,然后看看我们的Apache已经能够运行PHP了。呵呵。
如果你碰到其他类似提示:
cannot restore segment prot after reloc: Permission denied
哪应该是SELinux的问题,可以考虑把它关闭。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: