suPHP and phpMyAdmin on Ubuntu 12.04

If you use suPHP you will notice that web applications like phpMyAdmin that are installed via the apt-get package manager won’t work anymore.

Thankfully this is easy to fix, you only need to edit the file /etc/apache2/mods-available/php5.conf and add a <Directory /usr/share></Directory> container around ifmodule so that the file looks like

<Directory /usr/share>
<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>
</Directory>

Then enable php5 again (which was probably disabled when you installed suphp)

a2enmod php5

Restart apache and phpMyAdmin should work

/etc/init.d/apache2 restart

This will enable the php5 module for applications that are installed into /usr/share while websites in your webfolder will still be served by the suPHP module.
If the configuration does not work immediately also try to restart your web browser, most modern browsers just give you back a cached result instead of checking if something changed on the website. Personally, I like to use Links2 for testing.

The idea for this came from http://serverfault.com/a/211942/65036, but most steps mentioned there are not necessary in the latest Ubuntu version.

 

2 Replies to “suPHP and phpMyAdmin on Ubuntu 12.04”

  1. in so many sites offering a solution about conflict phpmyadmin and suphp
    only this is reliable.
    tried everything but managed with this.
    thank you

Comments are closed.