Debian, lighttpd and phpmyadmin

Short recipe for getting lighttpd and phpmyadmin to work on Debian.

Lighttpd is quite easy to build for debian. Once you’ve built that apt-get install php4-cgi phpmyadmin. During the install process for php4-cgi, some apache packages might get added. I suggest you remove them, they aren’t needed: sudo apt-get remove apache2-utils apache-common libapache-mod-php4 –purge.

Next step is to edit /etc/lighttpd/lighttpd.conf. Add “mod_alias”, to server.modules and alias.url = ( “/phpmyadmin/” => “/usr/share/phpmyadmin/”)

Finally, add or uncomment the following, making sure to note the bin-path.
fastcgi.server = ( “.php” => ( “localhost” => ( “socket” => “/tmp/php-fastcgi.socket”, “bin-path” => “/usr/bin/php4-cgi”) ) ).

You’ll need to access phpmyadmin via http://server.name/phpmyadmin/index.php. For some reason it doesn’t work without the index.php. Haven’t figured that bit out yet. (server.indexfiles is set appropriately.)

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

8 comments

#1 Gerardo on 10.14.05 at 7:35 am

The reason is the ending slash on the alias line:

http://example.com/phpmyadmin

is NOT found, but

http://example.com/phpmyadmin/

should work in your configuration.

#2 Andreas on 02.17.06 at 12:20 am

I’ve installed Lighttpd for Kubuntu 5.10. I have also installed MySQL5 from Dotdeb.
Then I followed your instructions above, but for php5-cgi instead. PHPMyAdmin works, but I got a problem
when trying to add more extensions to PHP now. Every extension I try to install fails because of PHPMyAdmin. It must have something to do with the fact PHPMyAdmin installed Apache (and I removed Apache). The package manager also states that PHPMyAdmin is broken, I guess it’s because I removed Apache. What can I do to fix this!? I want to be able to add php extensions to my Lighttpd/PHP5 server. How?

#3 Nicholas Lee on 02.17.06 at 8:04 am

It’s possible that removing Apache also removes the extensions you’ve just installed. Depends on the package dependencies and where lighttpd can provide these. Have you tried leaving apache installed but not running? ie. Deleting the rc?.d startup scripts and stopping the process.

I’ve stopped running this setup recently, in the process of migrating services around. Some time in the next month I’ll check out the php4 modules and post an updated entry.

#4 greg on 03.21.07 at 4:24 am

yo,
add: static-file.exclude-extensions = (“.php”, “.pl”, “.cgi”, “.fcgi”)
to your lighttpd.conf – this will help with your index.php-problem…

#5 ire on 06.20.07 at 4:53 pm

i think this should solved the problem

alias.url = ( “/phpmyadmin/” => “/usr/share/phpmyadmin/index.php”)

#6 DanielS on 01.12.10 at 6:19 pm

I tried following your directions, and have the alias setup and working however when I try to view the phpmyadmin page I recieve a 403 – Forbidden error when viewing from a machine in the local network, any idea's as to why?

#7 Gleb Piatikow on 02.24.10 at 12:32 am

Oh man. Great post, but because I'm a complete noob in Linux-server stuff I just copied and pasted the italic text… And "" look different then :)

Man, it took me ages to figure out that :) )) Now working fine, thanks a million! Cheers.

#8 Nicholas_Lee on 02.24.10 at 2:27 am

It's funny that this really old post is still useful for people. I should update it with some code boxes so people don't have the " copy and paste issue.

Leave a Comment