在CentOS平台,安装httpd-2.2.4 和php-5.2.3,一切顺利,最后一步重新启动apache报如下错误:
httpd: Syntax error on line 53 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp5.so into server: /usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
解决办法:
原因是Linux有一个SELinux保护模式引起的。
1.关闭SELINUX的方法:
vi /etc linux/config 将SELINUX=enforcing 改成SELINUX=disabled 需要重启
2. 不关闭SELINUX的方法:
# setenforce 0
# chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t /usr/local/apache/modules/libphp5.so
# service httpd restart
# setenforce 1