Home >Backend Development >PHP Problem >What should I do if yum httpd does not parse php?
yum Solution to the problem that httpd does not parse php: 1. Open the "httpd.conf" file and add the "index.php" index; 2. Add the file parsing type and modify the content such as "AddType application/x-httpd -php .php"; 3. Set the php-fpm connection parameters and add the fastcgi support module; 4. Reload the httpd service.
The operating environment of this tutorial: linux5.9.8 system, PHP8.1 version, DELL G3 computer
yum httpd does not parse php what to do?
yum installs php apache (httpd) cannot parse the php interface normally
Background
After yum installs php7.2 httpd, apache cannot Normally parse index.php
Solution
Generally just modify httpd.conf, the bracketed path is the file I actually modified
Add index.php Index (/etc/httpd/conf/httpd.conf)
<IfModule dir_module> DirectoryIndex index.php index.htm index.html #增加index.php </IfModule>
Add file parsing type (/etc/httpd/conf/httpd.conf)
AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php#增加php类型
Set php-fpm connection parameters ( /etc/httpd/conf/httpd.conf)
SetHandler "proxy:fcgi://127.0.0.1:9000"#增加到httpd.conf #也可用socket模式连接 #/path/to/unix/socket必须和php-fpm.conf里面配置的一致 #SetHandler "proxy:unix:/path/to/unix/socket|fcgi://localhost" // unix socket 形式
Add fastcgi support module (/etc/httpd/conf.modules.d/00-proxy.conf)
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
Reload httpd Service
systemctl restart httpd #重启
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What should I do if yum httpd does not parse php?. For more information, please follow other related articles on the PHP Chinese website!