I upgraded to Ubuntu 10.04 this morning and immediately noticed I could no longer serve php applications from my home directory. When I tried to visit one of my projects, http://test.local for example, Firefox opened a download dialog with a message similar to “You have chosen to open index.phtml . . .”
After quite a bit of googling and forum searching, I went to Twitter asking for help. Many thanks to @sypherNL for helping me resolve this one.
It seems that something has changed in /etc/apache2/mods-enabled/php5.conf. If you’re experiencing this same issue, check your php5.conf and see if it matches mine.
<IfModule mod_php5.c> <FilesMatch "\.ph(p3?|tml)$"> SetHandler application/x-httpd-php </FilesMatch> <FilesMatch "\.phps$"> SetHandler application/x-httpd-php-source </FilesMatch> # 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>
If your php5.conf file looks like the one above, simply comment out the
<IfModule mod_userdir.c>lines as instructed. Once that’s done, restart apache with the following command:
sudo /etc/init.d/apache2 reload
Clear your browser’s cache and try to visit your site again. I didn’t think the fix took at first, but after clearing cache everything worked just fine.
Related Links
- Thanks again to @sypherNL for showing me how to resolve this one.
- Also see Marco Rodrigues’ post Your public_html with PHP5 isn’t working in Ubuntu 10.04 Lucid?
magic. With a headless server I was wondering what my next move was going to be!
Many thanks for saving me many hours of googling at midnight!
Ah, the joys of headless servers
Glad the article helped out.
Thanks! Had the exact same problem on my work machine after upgrading to 10.04 over the weekend. Now I can go back to looking busy
Thanks. I was going crazy.
You bailed me out big time. Thanks!
Now about reviewing the op’s post we like the above as it’s correct so it’s pleasant to read from a person thats blogging info such as this online