Search code examples
phpapachelamp

Cant find AddHandler of PHP inside Apache configuration files


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!


Solution

  • Here's a fragment from one of my configurations (Apache/2.4.25):

    <FilesMatch ".+\.ph(ar|p|tml)$">
         SetHandler application/x-httpd-php 
    </FilesMatch>
    

    Try grep -R php in your /etc/APACHE_CONFIG_DIR