phpMyAdmin + Lighttpd in Gentoo

Usually installing software in Gentoo is a piece of cake. Just emerge what you want and (with the right USE flags) and everything will be ready for you. However, as today I’ve found out today, installing phpMyAdmin with Lighttpd isn’t trivial as it should be.

In this post I’ll try to walk you through the necessary steps to install phpMyAdmin with Lighttpd in Gentoo.

Installing Lighttpd and PHP

Before installing Lighttpd and PHP you’ll need to enable some USE flags. For Lighttpd you’ll need to at least enable the php and fastcgi USE flags. For PHP enable the cgi, crypt, ctype, pcre, session, unicode. The first one is required for working with Lighttpd, while the others are required for phpMyAdmin.

See the handbook for information about enabling USE flags.

Now install the packages

emerge -av lighttpd php

After installation is complete, start the Lighttpd process

/etc/init.d/lighttpd start

and you should have a working Lighttpd server with PHP support.

Installing phpMyAdmin

phpMyAdmin depends on a package called webapp-config. While usually we let Portage take care of dependencies, this time we’ll have to install webapp-config manually before we install phpMyAdmin, so we can change its configuration for suit Lighttpd.

emerge -av --oneshot webapp-config

After installation is done edit using your favourite editor the /etc/vhosts/webapp-config and change the line:




Now we are ready to install phpMyAdmin.

emerge -av phpmyadmin

After installation is complete, you’ll need to create a phpMyAdmin configuration file

cp /var/www/localhost/htdocs/phpmyadmin/ /var/www/localhost/htdocs/phpmyadmin/

Now open the newly created configuration file and edit the line with the blowfish_secret (at the top of the file) as explained in it. An easy way to generate the password would be to use spass.

Now if you use the default Lighttpd configurations you’re done. You can access the phpMyAdmin via http://localhost/phpmyadmin. If however you’ve changed the document root, there is one more step for you. Enable the mod_alias module in /etc/lighttpd/lighttpd.conf and append to the file

alias.url += ("/phpmyadmin" => "/var/www/localhost/htdocs/phpmyadmin")

and don’t forget to restart the Lighttpd server after making the changes.

You should have by now everything installed and configured to work. If you have any further questions don’t hesitate to comment.

1 thought on “phpMyAdmin + Lighttpd in Gentoo

Leave a Reply

Your email address will not be published. Required fields are marked *


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