无法在Apache配置文件中找到PHP的Addhandler
我已经安装了CentOS(最新8和流9),并且确实安装了PHP和Apache:
dnf install httpd php
一切正常,并且PHP文件正在正确解释。
我意识到有一个文件,位于/etc/httpd/conf.modules.d/20-php.conf
使用以下行,将PHP加载到apache内部,例如:
LoadModule php_module modules/libphp.so
伟大!但是我在其他任何地方都找不到Addhandler XXXX PHP
之类的代码。在所有之前,我安装了PHP+Apache,总会使用Addhandler
加载PHP的行。
我之所以要求这个,是因为我想允许PHP在我的整个服务器中分发,但是如果用户访问任何具有名称dons_interpret_php
的目录,我不希望对PHP进行解释。在这种情况下,如果此目录内有一个PHP文件,则应使用Apache 的服务器,而无需解释其内容。
我在Google上找到了一些方法来做到这一点,但是所有这些都需要修改行Addhandler
,但我找不到任何地方(不是在httpd.conf中,而不是在VirtualHosts文件中...没有地点!)。
太感谢了!
I have a fresh install of CentOS (latest 8 and Stream 9) and I did this do install PHP and Apache:
dnf install httpd php
Everything works fine and PHP files are being interpreted correctly.
I realized there is a file at /etc/httpd/conf.modules.d/20-php.conf
that loads PHP inside Apache using a line like:
LoadModule php_module modules/libphp.so
Great! But I cant find anywhere else a code like AddHandler xxxx php
. On all the previous times I installed PHP+Apache there always would be a line to load php using AddHandler
.
I am asking this because I want to allow PHP to be interepreted in my entire server HOWEVER I dont want PHP to be interpreted if the user access any directory with name dont_interpret_php
. In this case, if there is a PHP file inside this directory, it should be server by Apache as is
, without interpreting its content.
I found some ways on Google to do that but all of them require modifying the line AddHandler
but I cant find it anywhere (not in httpd.conf, not in virtualhosts file... no where!).
Thank you so much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我的一种配置中的片段(apache/2.4.25):
在您的/etc/etcache_config_dir中尝试
grep -r php
Here's a fragment from one of my configurations (Apache/2.4.25):
Try
grep -R php
in your /etc/APACHE_CONFIG_DIR