Installing PHP on Debian without Apache

Aug 1, 2013 • 0 minute read

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.

(Read more)

Setting up a Web Server on Ubuntu/Debian

Jul 23, 2011 • 2 minute read

Setting up a web server with Apache, PHP, and MySQL on any Debian-based system is really easy thanks to APT (Advanced Packaging Tool). Follow along and you’ll have a web server set up within fifteen minutes.

(Read more)

Dynamic Virtual Hosts Using .htaccess

May 20, 2011 • 1 minute read

There are several ways to set up virtual hosts on your web server. One of the more common methods is to manually create a [<VirtualHost>](http://httpd.apache.org/docs/2.0/mod/core.html#virtualhost) record for each virtual host. While using this method is fine, it can end you up with a huge configuration file that is difficult to manage.

Because all of my virtual hosts are sub-directories of my web server’s base directory, I prefer to dynamically allocate the virtual host directory based on the host name. For example, I want wildlyinaccurate.localhost to point to /var/www/wildlyinaccurate. This can be achieved by modifying the .htaccess file of your web server’s base directory:

(Read more)