After installing a basic LAMP (Linux, Apache, MySQL & PHP) stack in Ubuntu you will find that Apache will prompt you to download .php files (rather than opening them in your browser).
The solution is to edit the /etc/apache2/mods-available/php5.conf file:
sudo nano /etc/apache2/mods-available/php5.conf
The lower half of php5.conf reads as follows:
# To re-enable php in user directories comment the following lines # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it # prevents .htaccess files from disabling it. <IfModule mod_userdir.c> <Directory /home/*/public_html> php_admin_value engine Off </Directory> </IfModule> </IfModule>
Simply comment out the lines from <IfModule …> to </IfModule> as directed:
# To re-enable php in user directories comment the following lines # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it # prevents .htaccess files from disabling it. # <IfModule mod_userdir.c> # <Directory /home/*/public_html> # php_admin_value engine Off # </Directory> # </IfModule> #</IfModule>
Save php5.conf as then restart Apache:
sudo /etc/init.d/apache2 restart
You will now be able to open .php files in your browser.
Advertisements

Hrm. That’s weird. You must have some sort of weird configuration with Apache2, because php should resolve by default just fine. The first thing I do is make a php_info.php file with nothing but after installing Apache to test if it works and I have never once experienced your issue. So I just wanted you to know that this issue is your issue and is not at all common on Apache2 in the LAMP stack on Ubuntu 10.04 SE.
hrm… didn’t resolve my php code here due to your blog host restrictions (kinda lame isn’t it?) but you can use
I typically install a minimal virtual machine from the Ubuntu server .iso and then select the LAMP stack during installation.
A quick look again also yielded this solution: http://netbeans.org/kb/docs/php/configure-php-environment-ubuntu.html
apt-get –purge remove php5-common
apt-get install php5 phpmyadmin
it works 🙂 !!!!!
Thanks. It worked!
Well, maybe we don’t need to comment the last line, but still.. it didn’t worked for me.. I’m thinking of uninstalling the lamp-server^ and then manually install 😦
Same problem here on debian, this worked. Thanks karma++
Thanks it works! 😛
Thank you!