Help with htaccess: PHP not parsing in one directory

Discussion in 'PHP' started by jk_dp, May 3, 2009.

  1. #1
    Hey I hope someone can help: I've got a problem where PHP does not parse in one particular directory.

    Instead I see the download file dialog for index.php, and for index.html which has some php code in it, it displays the code instead of executing it.

    I've checked and phpinfo works fine in the root, and in other directories on the same server/domain.

    This one directory has its own .htaccess, but it was working previously, and stopped sometime in the last few days:

    AddDefaultCharset utf-8
    AddHandler application/x-httpd-php .php .html .htm

    RewriteEngine on
    RewriteRule ^stats\.js$ stats.php

    I am not a PHP expert - can anyone shed some light on this behavior? I havent found anything on google that talks about PHP not parsing in one directory only.

    Thanks,,
    JK
     
    jk_dp, May 3, 2009 IP
  2. oburlaca

    oburlaca Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What happens if you just remove the "AddHandler application/x-httpd-php .php .html .htm" line?
     
    oburlaca, May 4, 2009 IP
  3. jk_dp

    jk_dp Peon

    Messages:
    66
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    But I need that line because I have some php code inside a .html file. It will not be parsed without that line. It was working and parsing correctly, but it just stopped.

    I have confirmed that it is probably the .htaccess. I created a new directory with just phpinfo in it, and it worked. I added the .htaccess and it stopped working.

    I still dont know how to fix it however

    JK
     
    jk_dp, May 4, 2009 IP
  4. HomeComputerGames

    HomeComputerGames Peon

    Messages:
    871
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I believe when running PHP as CGI you use AddHandler.
    When using PHP as a module AddType is used.

    Just for fun try replacing with this. You can always change it back.
    AddType application/x-httpd-php .php .html .htm
     
    HomeComputerGames, May 4, 2009 IP