apache无法启动 Cannot load /usr/local/apache2/modules/libphp5.so into server

[root@localhost ~]# /usr/local/apache2/bin/apachectl start
httpd: Syntax error on line 62 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
 
 

php安装好以后
apache2 无法启动
最后一步重新启动apache报如下错误

原因是Linux有一个SELinux保护模式引起的。

Syntax error on line 268 of /usr/local/apache2/conf/httpd.conf:

Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied

解决办法

2.不关闭SELINUX的方法:

# setenforce 0
# chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t /usr/local/apache2/modules/libphp5.so
# /usr/local/apache2/bin/apachectl start

# setenforce 1


 

你可能感兴趣的:(apache,linux,server,职场,休闲)