Installing PHP on Debian without Apache

When you apt-get install php5 on a Debian/Ubuntu server, you’ll notice that APT will automatically install a bunch of apache2 packages as well. This can be pretty annoying if you’re planning on using another web server (or no web server at all).

If you take a look at the package dependencies (Debian/Ubuntu) you’ll see why this happens – php5 needs one of either libapache2-mod-php5, libapache2-mod-php5filter, php5-cgi, or php5-fpm. APT doesn’t care which package it installs; it just picks the first package that satisfies the dependency, which is why you get the apache2 packages.

You can get around this by installing one of the other dependencies before php5. For example, apt-get install php5-fpm php5 or apt-get install php5-cgi php5.

Did you find this post useful?

2 thoughts on “Installing PHP on Debian without Apache

  1. Ian Simmons says:

    Nice tip. Thanks. Might want to just do php cli. Also with php built in server a lot of web dev can be done right from a ~/projects folder without the need for apache.

Leave a Reply