Apache, MySql and PHP Howto (from source)

Everyone loves web applications that use Apache, PHP and MySQL, and everyone loves having their very own web servere that runs them. The problem is, how do you do it? If your’re like me, you don’t do it enough to remember, so here are some quick directions to get you started.

First we must download the latest versions of Apache, MySQL and PHP and extract them. You may have to dig a little since these places are always changing where they keep things, but the links below should be of some use. Just make sure you download the source distribution.

MySQL Download >
Apache Download >
PHP Download >

I always put these applications in /usr/local/server, but you can select whatever location you like. Simply add whatever directory you want into the –prefix directive.

First, let’s build and install MySQL

# cd /path/to/mysql/source/directory
# ./configure –prefix=/usr/local/server/mysql
# make
# make install

Next, we have to build and install the Apache web server. In this example, we are building it with SSL, URL Rewrite and Shared Object support.

# cd /path/to/apache/source/directory
# ./configure –prefix=/usr/local/server/apache –enable-module=so –enable-rewrite -enable-ssl
# make
# make install

Finally, build and install PHP. There are lots of things you can include when building PHP, but these are the most common.

# ./configure –with-apxs2=/usr/local/server/apache/bin/apxs –with-mysql=/usr/local/server/mysql –enable-debug=no –enable-track-vars=yes –enable-bcmath=yes –enable-memory-limit=yes –with-imap –with-ldap=/usr/local/server/ldap –enable-ftp –with-gd –with-jpeg-dir=/usr/local –with-png-dir=/usr/local –with-zlib-dir=/usr
# make
# make install

That should do it… If everything went well, you can start up your fancy new apache web server.

# /usr/local/server/apache/bin/apachectl start

One thought on “Apache, MySql and PHP Howto (from source)

  1. Pingback: KMM Projects » Blog Archive » PHP woes

Leave a Reply