can't execute php in html since EA4 upgrade
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]
Hello, today is .
[/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:
{
"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"
]
}
-
This probably should be 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.0 -
AddHandler application/x-httpd-php5 .html
Hello, Yes, as mentioned in the previous post, try using the following line instead:AddHandler application/x-httpd-ea-php56 .html
Note that "php56" should reflect the version of PHP utilized for the account. Thank you.0 -
Is there any way to setup this PHP execution in HTML globally for the entire Apache server? Thanks 0 -
Is there any way to setup this PHP execution in HTML globally for the entire Apache server? Thanks
Hello, You should be able to complete the following steps to customize the default "" statement: 1. Copy the Apache 2.4 template for EasyApache 4 to allow for customization: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:vi /var/cpanel/templates/apache2_4/ea4_main.local
3. Save the changes, and then run:/scripts/rebuildhttpdconf
Let us know if this helps. Thank you.0 -
Thanks, will try that and let you know. 0
Please sign in to leave a comment.
Comments
5 comments