Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 stackoverflow.com Jun 21 '11 at 0:44

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

3 Answers 3

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
    </Directory>
</IfModule>

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: http://www.lamphowto.com/

share|improve this answer

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

See: http://dan.drydog.com/apache2php.html

share|improve this answer

Your Answer

 
discard

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