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

王朝php·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

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的问题,可以考虑把它关闭。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航