search
HomeBackend DevelopmentPHP ProblemWhat 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.

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

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!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.