Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

apache handler application/x-httpd-php5 not working

Discussion in 'EasyApache' started by slsdoug, Aug 16, 2017.

Tags:
  1. slsdoug

    slsdoug Registered

    Joined:
    Aug 16, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Henderson
    cPanel Access Level:
    Website Owner
    I have been using the .htaccess line for years:
    AddType application/x-httpd-php5 .php .htm .html
    to run .htm and .html files as .php. However, since migrating to easyapache 4 it doesn't work anymore. I have tried countless variations to get .htm, .html to execute and .php but to no avail. Any ideas? Running apache 2.4, PHP 5.6
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,165
    Likes Received:
    1,371
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    With EasyApache 4, the entry should look like this (if you are using PHP 5.6):

    Code:
    AddType application/x-httpd-ea-php56 .html .htm
    Note that the entry for .php files is automatically configured as part of the MultiPHP functionality in EasyApache 4. EX:

    Code:
    # php -- BEGIN cPanel-generated handler, do not edit
    # Set the “ea-php56” package as the default “PHP” programming language.
    <IfModule mime_module>
      AddType application/x-httpd-php .php .php5 .phtml
    </IfModule>
    # php -- END cPanel-generated handler, do not edit
    Thus, you should not setup a custom MIME type for .php files if you want to ensure MultiPHP functionality works as expected.

    Thanks!
     
  3. slsdoug

    slsdoug Registered

    Joined:
    Aug 16, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Henderson
    cPanel Access Level:
    Website Owner
    The only way I could get it to work was with this line:
    AddType application/x-httpd-ea-php56 .html .htm OR
    AddHandler application/x-httpd-ea-php56 .html .htm
    I have PHP 5.5, 5.6, 7.1 installed and am using 5.6 on the particular site in question.
    I'm not sure which is the best way to go.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,165
    Likes Received:
    1,371
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    This is the correct syntax if you are using PHP 5.6. It's also the same value used by another user on the following post:

    PHP Script is not working in .html file

    Thank you.
     
  5. slsdoug

    slsdoug Registered

    Joined:
    Aug 16, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Henderson
    cPanel Access Level:
    Website Owner
    When do I use AddType or AddHandler? Both seem to work.
    Will
    AddType application/x-httpd-ea-php71 .html .htm
    work for PHP 7.1?
    What shows all the MIME types on a server?
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,165
    Likes Received:
    1,371
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    The AddType directive maps the given filename extensions onto the specified content type and the AddHandler directive maps the filename extensions to a specific handler (e.g. application/x-httpd-ea-php56). You can read more about how Mod_Mime works at:

    mod_mime - Apache HTTP Server Version 2.4

    Yes, it will work the same way it would for PHP 5.6 as long as PHP 7.1 is installed on the server.

    You can see a list of all MIME type by viewing the /etc/mime.types file:

    Code:
    cat /etc/mime.types
    Thank you.
     
Loading...

Share This Page