Skip to main content

Execute .html as .php

Comments

4 comments

  • PatrickVeenstra
    SOLUTION: The correct line (for EasyApache 4) is AddHandler application/x-httpd-ea-php56 .html
    0
  • sparek-3
    Would encourage against this. If you move the account to a different server, perhaps one that doesn't use cPanel and you forget that you had this here, you run a real risk of exposing your PHP code to regular website visitors. If that PHP code has private and confidential information, then that could be a disaster. That's kind of why they created the .php file extension. Files with a .php extension are expected to be parsed through a PHP interpreter. Files with a .html extension are not. Perhaps you have a specific reason for needing this. And I'm not saying that it is inherently wrong. But I am detailing why I think it is a bad idea.
    0
  • PatrickVeenstra
    I'd normally agree with you but this specific case requires (automatically generated) .html files to be parsed as php to auto prepend code.
    0
  • cPanelLauren
    Hi @PatrickVeenstra I'm glad to see you found the solution for your issue. Thank you for posting the solution that worked for you. Thanks!
    0

Please sign in to leave a comment.