.php4 extensions downloading instead of displaying

Discussion in 'Apache' started by Kilsally, Aug 10, 2011.

  1. #1
    Apologies if this is a simple fix - total newbie to servers. Have moved numerous sites across from another host (became unreliable) to my new VPS. Everything is running apart from one site which the person designed with all the php files ending in .php4 . The index page is html which links to the rest of the site which are files ending .php4. These files download in the browser instead of displaying. The VPS has php5 installed but renaming the file to .php and the file displays just fine. So is there an easy way to associate .php4 files as ordinary .php files or am i going to have to go through every page of the site renaming all the links / urls to .php ? I have googled this and had a try at adding stuff to httpd.conf and php.ini from the virtuozzo panel (affects the whole vps), have also tried placing .htaccess file in the webspace of the individual website giving bother with various things like AddType /x-httpd-php .php .php4 to no avail. any help appreciated.
     
    Kilsally, Aug 10, 2011 IP
  2. helpinghost

    helpinghost Active Member

    Messages:
    36
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    53
    #2
    In your Apache configuration look for the place where the .php extensions are setup.

    It should look like this:
    AddType application/x-httpd-php .php

    right after that add a line like this:
    AddType application/x-httpd-php .php4

    Reload or Restart apache.
    Now your.php4 files should be working as well.
     
    helpinghost, Aug 11, 2011 IP
  3. Kilsally

    Kilsally Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That line seems to already be in place in apache2.conf - is that the right place to be looking? httpd.conf is a blank file and have tried adding it to there too.
     
    Kilsally, Aug 11, 2011 IP
  4. helpinghost

    helpinghost Active Member

    Messages:
    36
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    53
    #4
    That sounds like the right place (its different for every OS). Are there any <IfModule> Directives around those lines that could prevent them from being active?
     
    helpinghost, Aug 12, 2011 IP
  5. unknownpray

    unknownpray Active Member

    Messages:
    3,831
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    70
    #5
    It is exactly for these type of cases that arise that I should ask an expert instead of doing a "Do It Yourself" approach
     
    unknownpray, Aug 12, 2011 IP
  6. Kilsally

    Kilsally Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    seems putting said line into .htaccess in root folder of website concerned has sorted it out atleast for that particular webspace on the vps
     
    Kilsally, Aug 14, 2011 IP