yum httpd 不解析php怎么办

藏色散人
Freigeben: 2023-03-17 22:56:02
Original
2682 人浏览过

yum httpd不解析php的解决办法:1、打开“httpd.conf”文件,添加“index.php”索引;2、增加文件解析类型,修改内容如“AddType application/x-httpd-php .php”;3、设置php-fpm连接参数,并增加fastcgi支持模块;4、重载httpd服务即可。

yum httpd 不解析php怎么办

本教程操作环境:linux5.9.8系统、PHP8.1版、DELL G3电脑

yum httpd 不解析php怎么办?

yum安装php apache(httpd)无法正常解析php界面

背景

yum安装php7.2 httpd后,apache无法正常解析index.php

解决办法

一般修改httpd.conf即可,括号路径为我实际修改文件

添加index.php索引(/etc/httpd/conf/httpd.conf)


    DirectoryIndex index.php index.htm index.html #增加index.php
Nach dem Login kopieren

增加文件解析类型(/etc/httpd/conf/httpd.conf)

    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php#增加php类型
Nach dem Login kopieren

设置php-fpm连接参数(/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 形式
Nach dem Login kopieren

增加fastcgi支持模块(/etc/httpd/conf.modules.d/00-proxy.conf)

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
Nach dem Login kopieren

重载httpd服务

systemctl restart httpd #重启
Nach dem Login kopieren

推荐学习:《PHP视频教程

以上是yum httpd 不解析php怎么办的详细内容。更多信息请关注PHP中文网其他相关文章!

Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!