Home >Backend Development >PHP Problem >What should I do if apache cannot start after installing php on centos?
Solution to the problem that apache cannot start after installing php on centos: 1. Edit "/etc/sysconfig/selinux" and add "SELINUX=disabled"; 2. Just don't close SELINUX.
The operating environment of this article: centOS6.8 system, PHP5 version, DELL G3 computer
apache cannot start after installing php on centos Solution:
After installing PHP, restart apache and report the following error
The reason is that Linux has a SELinux protection mode.
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
Solution
1. Edit /etc/sysconfig/selinux and find:
# 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
If SELINUX is already SELINUX=disabled, then there is no need to change it, otherwise Comment out SELINUX=enforcing and add a new line:
SELINUX=disabled
Save and exit.
2. How to not close 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
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What should I do if apache cannot start after installing php on centos?. For more information, please follow other related articles on the PHP Chinese website!