htaccess rule to parse php in html files not working

前端 未结 4 673
借酒劲吻你
借酒劲吻你 2020-12-03 20:17

can\'t for the life of me work out why this isn\'t working - on a dreamhost server, I\'ve created an htaccess file and added AddHandler php5-cgi .html .htm to a

相关标签:
4条回答
  • 2020-12-03 20:21

    For me it is working for only like this:

    AddHandler php-cgi .php .htm
    
    0 讨论(0)
  • 2020-12-03 20:35

    Is your server using suPHP rather than mod_php or plain php-cgi?

    Try using

    AddHandler x-httpd-php .html .htm
    

    or

    AddType application/x-httpd-php .html .htm
    

    instead.

    Postscript

    Shared Hosting services use UID based separation on individual accounts from each others. Most use suPHP, but some use suEXEC. They will use one of these. Both act as a su wrapper around php-cgi so you can't tell from the phpinfo()as its PHP scripting engine as this will report Server API CGI/FastCGI in both cases. For CGI initiated scripts, phpinfo doesn't report on the Apache config. You need either to look at your hosting provider's FAQ or possibly try:

     <?php
     header( "Content-Type: text/plain");
     echo system('grep -iR LoadModule /etc/httpd /etc/apache2');
    

    The hosting provider's support forums / FAQ might give specific configuration advice here. Have you tried them?

    0 讨论(0)
  • 2020-12-03 20:39

    try this

      AddType application/x-httpd-php .html .htm
    

    The above setting will work if the apache is picking php as a module.

     AddHandler application/x-httpd-php .html .htm
    

    or

     AddHandler application/x-httpd-php5 .html .htm
    

    above will work if apache is executing php as CGI?

    there is no harm i would say to put both of the above conditions together but try one over other and see if it work for you.

    read more here

    0 讨论(0)
  • I've got the same problem as you but I just put this AddType php .html .htm to my .htaccess, it's working.

    0 讨论(0)
提交回复
热议问题