What should I do if apache does not support php?

藏色散人
Release: 2023-03-02 20:40:02
Original
3386 people have browsed it

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

1. Add index.php

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>
Copy after login

Recommended: "PHP Tutorial"

2. In < IfModule mime_module> Add a line AddType application/x-httpd-php .php

 AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Copy after login

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

apachectl -t
Copy after login

4. Reload the configuration file

apachectl graceful
Copy after login

5. Check whether the php module is loaded

apachectl -M
Copy after login

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

libphp7.so installation

apt-get install libapache2-mod-php7.2 
a2enmod php7.2
Copy after login

Load the php module in the httpd.cnf configuration file

LoadModule php7_module modules/libphp7.2so
Copy after login

View all loaded modules of apache

apachectl -t -D DUMP_MODULES
Copy after login

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

Delete all php

apt remove php*
Copy after login

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

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!

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
Popular Tutorials
More>
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!