Home > Backend Development > PHP Problem > What should I do if yum httpd does not parse php?

What should I do if yum httpd does not parse php?

藏色散人
Release: 2023-03-17 22:56:02
Original
2822 people have browsed it

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.

What should I do if yum httpd does not parse php?

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

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

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

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

Reload httpd Service

systemctl restart httpd #重启
Copy after login

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!

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