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!

Parse .html as PHP?

Discussion in 'EasyApache' started by zylstra, Mar 20, 2017.

Tags:
  1. zylstra

    zylstra Member

    Joined:
    Dec 21, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    151
    I would like my server to parse .html as PHP if I add AddHandler application/x-httpd-php .html to .htaccess. The server is running EasyApache 4. I tried adding each
    application/x-httpd-php="php:/usr/bin/php"
    and
    application/x-httpd-php="php:/opt/cpanel/ea-php70/root/usr/bin/php-cgi"
    separately to /etc/suphp.conf and restarted Apache, but neither worked.

    How do I get my my server to parse .html as PHP if I add AddHandler application/x-httpd-php .html to the .htaccess file?
     
  2. cPanelJasonT

    cPanelJasonT Level 2 Technical Analyst
    Staff Member

    Joined:
    Oct 21, 2014
    Messages:
    54
    Likes Received:
    6
    Trophy Points:
    83
    cPanel Access Level:
    Root Administrator
    Hello,
    Thanks for reaching out.

    You are very close in your syntax for adding this handler. When using EasyApache4, the handler type changes so that instead of application/x-httpd-php, the line needs to match x-httpd-ea-phpxx, where x is the minor and major version of php. So to have php 7.0 from EasyApache4 used, you can use this code in the .htaccess file for a vhost:

    <IfModule mime_module>
    AddType application/x-httpd-ea-php70 .php .php5 .html
    </IfModule>
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. zylstra

    zylstra Member

    Joined:
    Dec 21, 2006
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    151
    Yes, I have tried that line, and it works, but my question is:

    How do I get my my server to parse .html as PHP if I add AddHandler application/x-httpd-php .html to the .htaccess file?
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,435
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Could you elaborate a little more on this question? For instance, is there any reason you prefer this line over the supported .htaccess entry referenced in the earlier post?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice