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.

can't execute php in html since EA4 upgrade

Discussion in 'EasyApache' started by jfall123, Sep 9, 2016.

Tags:
  1. jfall123

    jfall123 Well-Known Member

    Joined:
    Oct 31, 2005
    Messages:
    52
    Likes Received:
    1
    Trophy Points:
    8
    I'm seeing this across many servers I've recently upgraded to EA4. Using cPanel Apache handlers or adding this directly in to .htaccess (same as cPanel does through gui add handlers):

    AddHandler application/x-httpd-php5 .html

    *there is NOTHING else in the .htaccess other than the above*

    Will not execute php code in .html files. Trying a simple test.html file that has this in it:

    HTML:
    <html>
    <head></head>
    <body class="page_bg">
    Hello, today is <?php echo date('l, F jS, Y'); ?>.
    </body>
    </html>
    output is: Hello, today is . <--- missing the php output

    Tried the same with a simple phpinfo call in a html file and just loads blank, no errors.

    Same test.html file works fine on other non-upgraded cPanel servers using the same addhandler

    Note it's not prompting to download the file as if the wrong handler were entered etc. It's simply not executing any php code, it will display html only.

    EA4 is built with latest version of Apache, and PHP 5.6 suphp. I'm not seeing anything hitting the error logs

    If I execute the HTML file on the server directly VIA ssh using php test.html the php code works in it.

    Has EA4 somehow changed the way the PHP5 addhandler works?

    Here is a copy of my easyapache profile if it's of any help:

    Code:
    {
       "tags" : [
          "Apache 2.4",
          "PHP 5.6",
          "PHP 7.0"
       ],
       "name" : "ea4.profile",
       "version" : "1.0",
       "desc" : "Auto Generated profile",
       "pkgs" : [
          "ea-apache24",
          "ea-apache24-config",
          "ea-apache24-config-runtime",
          "ea-apache24-mod_asis",
          "ea-apache24-mod_authn_dbm",
          "ea-apache24-mod_authn_socache",
          "ea-apache24-mod_bwlimited",
          "ea-apache24-mod_cgi",
          "ea-apache24-mod_dbd",
          "ea-apache24-mod_deflate",
          "ea-apache24-mod_env",
          "ea-apache24-mod_expires",
          "ea-apache24-mod_headers",
          "ea-apache24-mod_mpm_prefork",
          "ea-apache24-mod_proxy",
          "ea-apache24-mod_proxy_http",
          "ea-apache24-mod_security2",
          "ea-apache24-mod_ssl",
          "ea-apache24-mod_suexec",
          "ea-apache24-mod_suphp",
          "ea-apache24-mod_unique_id",
          "ea-apache24-mod_version",
          "ea-apache24-tools",
          "ea-apr",
          "ea-apr-util",
          "ea-cpanel-tools",
          "ea-documentroot",
          "ea-libmcrypt",
          "ea-php-cli",
          "ea-php56",
          "ea-php56-libc-client",
          "ea-php56-pear",
          "ea-php56-php-bcmath",
          "ea-php56-php-calendar",
          "ea-php56-php-cli",
          "ea-php56-php-common",
          "ea-php56-php-curl",
          "ea-php56-php-devel",
          "ea-php56-php-ftp",
          "ea-php56-php-gd",
          "ea-php56-php-gettext",
          "ea-php56-php-iconv",
          "ea-php56-php-imap",
          "ea-php56-php-ioncube",
          "ea-php56-php-mbstring",
          "ea-php56-php-mcrypt",
          "ea-php56-php-mysqlnd",
          "ea-php56-php-pdo",
          "ea-php56-php-posix",
          "ea-php56-php-pspell",
          "ea-php56-php-soap",
          "ea-php56-php-sockets",
          "ea-php56-php-xml",
          "ea-php56-php-xmlrpc",
          "ea-php56-php-zendguard",
          "ea-php56-php-zip",
          "ea-php56-runtime",
          "ea-php70",
          "ea-php70-pear",
          "ea-php70-php-cli",
          "ea-php70-php-common",
          "ea-php70-php-curl",
          "ea-php70-php-devel",
          "ea-php70-php-ftp",
          "ea-php70-php-gd",
          "ea-php70-php-mcrypt",
          "ea-php70-php-mysqlnd",
          "ea-php70-php-pdo",
          "ea-php70-php-posix",
          "ea-php70-php-xml",
          "ea-php70-php-zip",
          "ea-php70-runtime"
       ]
    }
    
     
    #1 jfall123, Sep 9, 2016
    Last edited: Sep 9, 2016
  2. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,415
    Likes Received:
    29
    Trophy Points:
    48
    cPanel Access Level:
    Root Administrator
    This probably should be

    Code:
    AddHandler application/x-httpd-ea-php56 .html
    But the better solution is to not use PHP code in .html files. .html files are not setup as a standard extension for PHP code. You are going to run into portability concerns later down the road if you continue to do this. There's a reason .php file extensions exist.
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    33,397
    Likes Received:
    922
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Yes, as mentioned in the previous post, try using the following line instead:

    Code:
    AddHandler application/x-httpd-ea-php56 .html
    Note that "php56" should reflect the version of PHP utilized for the account.

    Thank you.
     
  4. sh4ka

    sh4ka Well-Known Member

    Joined:
    May 12, 2005
    Messages:
    444
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    US
    cPanel Access Level:
    DataCenter Provider
    Is there any way to setup this PHP execution in HTML globally for the entire Apache server?

    Thanks
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    33,397
    Likes Received:
    922
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    You should be able to complete the following steps to customize the default "<IfModule mime_module>" statement:

    1. Copy the Apache 2.4 template for EasyApache 4 to allow for customization:

    Code:
    cp -a /var/cpanel/templates/apache2_4/ea4_main.default /var/cpanel/templates/apache2_4/ea4_main.local
    2. Edit /var/cpanel/templates/apache2_4/ea4_main.local to change the entries to match your preferences:

    Code:
    vi /var/cpanel/templates/apache2_4/ea4_main.local
    3. Save the changes, and then run:

    Code:
    /scripts/rebuildhttpdconf
    Let us know if this helps.

    Thank you.
     
  6. sh4ka

    sh4ka Well-Known Member

    Joined:
    May 12, 2005
    Messages:
    444
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    US
    cPanel Access Level:
    DataCenter Provider
    Thanks, will try that and let you know.
     
Loading...

Share This Page