Home >Backend Development >PHP Problem >What 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.
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 91848f3314cff0c47dcc3ddb5ad631e1 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!