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.)

12 Comments

  1. Gerardo Said,

    October 14, 2005 @ 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 Said,

    February 17, 2006 @ 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 Said,

    February 17, 2006 @ 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 Said,

    March 21, 2007 @ 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 Said,

    June 20, 2007 @ 4:53 pm

    i think this should solved the problem

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

  6. DanielS Said,

    January 12, 2010 @ 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 Said,

    February 24, 2010 @ 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 Said,

    February 24, 2010 @ 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.

  9. Stephen Said,

    April 17, 2010 @ 6:19 pm

    I was lazy and from this web page copied and pasted:
    server.modules and alias.url = ( “/phpmyadmin/” => “/usr/share/phpmyadmin/”)
    right into my configuration file. It did not work because the quotation marks were not the standard quotation mark character. After replacing the quotation mark characters it worked.

  10. DarkLight188 Said,

    June 3, 2011 @ 11:40 pm

    This works:

    alias.url = ( "/phpmyadmin/" => "/usr/share/phpmyadmin/")

    Make sure if you copy and paste that you retype the quotes.

  11. Jon V Said,

    August 5, 2011 @ 2:52 pm

    If it does not work with /phpmyadmin , on the browser remove the / from ("/phpmyadmin/" => , to make it ("/phpmyadmin" => .

  12. wiki Said,

    September 18, 2011 @ 4:15 am

    alias.url = ( "/phpmyadmin" => "/usr/share/webapps/phpMyAdmin/")

    Then enable mod_alias, mod_fastcgi and mod_cgi in your config ( server.modules section )

    Update open_basedir in /etc/php/php.ini and add "/usr/share/webapps/".

    open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/

RSS feed for comments on this post