Fix PHPMyAdmin Error When Using suPHP on Ubuntu 14.04

Since i move to Ubuntu recently, i need to setup all the development environment. My stack is using Nginx with Apache + PHP as the webserver and use MySQL as database. Since i don’t like to use


as the home directory for the apache, i moved it to my /home/ivan/public_html folder. And to make it easier, i need to change PHP to run as my user role. For that i install suPHP module on Apache, and then chmod 755 all the php files.


Everything is working correctly, except PHPMyAdmin, since it is installed in


, and all the files and folders under root permissions. So when Apache run it, it cannot run the PHP. To fix it i just edit the file


and add these line below:


<Directory /usr/share>
    <IfModule mod_php5.c>
        <FilesMatch "\.ph(p3?|tml)$">
            SetHandler application/x-httpd-php

        <FilesMatch "\.phps$">
            SetHandler application/x-httpd-php-source

        # 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

By adding those line, means the suPHP mod will not run if the root directory us /usr/share/

After that don’t forget to restart your Apache:

sudo service apache2 restart

And now the PHPMyadmin will work perfectly!

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.