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.

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:
    55
    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>
     
  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 Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page