Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a public_html folder on my webserver at home and when I try to open php files on the browser tries to download the file instead of displaying. HTML files open fine and when i move the php file to /var/www it works fine. Any help would be great, Thank you.

share|improve this question

migrated from Jun 21 '11 at 0:44

This question came from our site for professional and enthusiast programmers.

up vote 3 down vote accepted

This blog post describes a case where the Apache config is specifically disabling PHP on those folders, in which case you need to find your Apache configuration file and remove/comment-out something like this:

<IfModule mod_userdir.c>
    <Directory /home/*/public_html>
        php_admin_value engine Off

Note that if you do this you had better trust every single user on your machine pretty well, since there's nothing stopping a user from creating a PHP file which can run as your apache user and do a lot of damage.

share|improve this answer

This is mos likely because you haven't setup the server to handle PHP files with PHP. Following this guide should help:

share|improve this answer

You need to make sure apache is configured to pass off .php files to mod_php for that folder.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.