判官007 发表于 2018-11-27 13:41:57

Cannot load /usr/local/apache2/modules/libphp5.so-Richard Shen运维/架构

编译安装php后,重新起动apache出现如下错误:
  httpd: Syntax error on line 61 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>  这是由于selinux引起的,所以需要这样一下:
  chcon -t textrel_shlib_t libphp5.so
原因是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>解决办法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
  或者按照以下方法:
  编辑/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
  保存,退出。

页: [1]
查看完整版本: Cannot load /usr/local/apache2/modules/libphp5.so-Richard Shen运维/架构