search
HomeBackend DevelopmentPHP ProblemWhat should I do if apache does not support php?

The solution to the problem that Apache does not support PHP: first modify the Apache configuration file; then reload the configuration file and check whether the PHP module is loaded; then install "libphp7.so"; and finally go to the official website to download the binary PHP package and install it.

What should I do if apache does not support php?

apache2 does not support php files. Solution

1. Modify the apache configuration file

vim /usr/local/apache2/conf/httpd.conf

1. Add index.php

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

Recommended: "PHP Tutorial"

2. In Add a line AddType application/x-httpd-php .php

 AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

3. Check whether the syntax of the configuration file httpd.cnf is correct

apachectl -t

4. Reload the configuration file

apachectl graceful

5. Check whether the php module is loaded

apachectl -M

See if there is php7_module (shared)

If there is no php7 module, then check whether there is the php7 module file libphp7. so

ls /usr/lib/apache2/modules/libphp7.2so

libphp7.so installation

apt-get install libapache2-mod-php7.2 
a2enmod php7.2

Load the php module in the httpd.cnf configuration file

LoadModule php7_module modules/libphp7.2so

View all loaded modules of apache

apachectl -t -D DUMP_MODULES

Finally found The ntp version of php is not thread-safe

Delete all php

apt remove php*

3. Go to the official website again to download the binary php package and install it

https://i.cnblogs.com/PostDone.aspx?postid=11143698&actiontip=%E5%8F%91%E5%B8%83%E6%88%90%E5%8A%9F
apt-get install libapache2-mod-php7.2

OK

The above is the detailed content of What should I do if apache does not support php?. 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

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version