PHP not interpreted in public_html in recent Ubuntu update

PHP recently stopped interpreting PHP scripts in public_html after a (Lucid) Ubuntu update: instead of displaying the generated HTML, it was just offering to download the script — the kind of “new” behaviour that leaves you baffled for a few minutes…

After reinstalling apache and PHP without any luck, I looked into Apache configuration, and in the PHP5 mod, here is what I found:

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

The PHP engine is explicitly disabled in public_html, yes sir. Comment out the bit above using hashes, restart your Apache server (sudo service apache2 force-reload), and you’re sorted.

Not sure why this change has been made, though.

 
---

Comment

  1. Thank you very much! You’ve solved a problem a friend of mine was having with his Ubuntu install as well. No idea why the boneheaded change — seems like a policy decision sysadmins would rather make rather than the distro.

    June Tate-Gans · 2010-05-05 05:12 · #

  2. Ah. Found it. According to http://bugs.debian.org/555606 it was disabled in Debian because of a security risk that allowed all users on a system to execute PHP code as www-data. Ubuntu just picked it up in a recent sync with Debian’s repositories.

    June Tate-Gans · 2010-05-05 05:55 · #

  3. You’re welcome!

    Thanks for the details, this seems to be the reason indeed.

    sebastien · 2010-05-06 13:35 · #

  4. not really sure if the update was an ubuntu one or a php one.

    abdul · 2010-10-10 10:04 · #

  5. Amazing tutorial, really helped me to put my new site design together quickly!

    custom essay · 2011-08-11 07:11 · #

your_ip_is_blacklisted_by sbl.spamhaus.org

---