What should I do if apache cannot start after installing php on centos?

藏色散人
Release: 2023-03-11 19:00:01
Original
2058 people have browsed it

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.

What should I do if apache cannot start after installing php on centos?

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
Copy after login

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
Copy after login

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
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!