Bizzard's Hackshop
Always under construction!

suPHP and Debian phpMyAdmin package

phpMyAdmin being the most used tool for managing MySQL databases comes as a package with Debian and works out of the box with “apt-get” along with apache, php and mysql.

But, when switching over to suPHP from the apache mod_php plugin, even if every other things work, phpMyAdmin fails.

The error looks like:

File does not exist: /usr/share/phpmyadmin/navigation.php<, referer: http://localhost/phpmyadmin/

This is because its configured to work only for mod_php. The configuration file is located at “/etc/phpmyadmin/apache2.conf”, which is symbolically linked at “/etc/apache2/conf.d/phpmyadmin.conf”

The easier option is to enable “mod_php” by typing in “a2enmod php5” as described at Sysadmin World.

I was not satisfied with the solution and determined to run phpMyAdmin with suPHP itself. So, explored the options by removing the symbolic link “/etc/apache2/conf.d/phpmyadmin.conf” and creating a new configuration file “etc/apache2/conf.d/phpmyadmin-suphp.conf”, with the following:

Alias /phpmyadmin /usr/share/phpmyadmin

AddType application/x-httpd-php .php .php3 .php4 .php5
suPHP_AddHandler application/x-httpd-php
suPHP_Engine on

Then the error changed to:

SoftException in Application.cpp:221: File "/usr/share/phpmyadmin/index.php" is not in document root of Vhost "/var/www"

This is familiar, as due to the security features of suPHP, only scripts within documentroot gets executed. Tried adding an exception at “/etc/suphp/suphp.conf” by changing the line docroot=/var/www:${HOME}/public_html to docroot=/var/www:${HOME}/public_html:/usr/share/phpmyadmin

It didn’t work out as the files are owned by root and gave the same error. Further experiments require changing file permissions, which might prevent the updation of the package or will break phpMyAdmin configuration when the package is upgraded.

So, satisfied myself by downloading the latest phpMyAdmin from the website and unpacking the zip to “/var/www/phpmyadmin”.

Tagged with: , , ,

Leave a Reply