SoftwarePractice.org: Home | Courseware | Wiki | Archive

Building an OS/X Web Server

From SoftwarePractice.org

This is a summary of how to build a web server for OS/X. There's nothing particular complicated about this, but since I'm doing it right now, I just wanted to make a few notes for next time. It's a condensed and OS/X-specific version of this series of articles:

One point to note is that I'm building this for a development environment on a desktop machine. So I've left out all the server configuration stuff that you would have to do for a proper server.

Install MySQL

This is the easy bit. Go get the binary distributions of MySQL and the GUI utilities from mysql.com:

Open the DMG files and follow the instructions.


Build Apache and PHP

OK, here's what I found. Do not use the Apache that comes with OS/X. Just build it fresh from source. It doesn't take all that much longer and it will work a whole lot better.

Untar the downloads and configure each of them as follows. For Apache:

./configure --enable-so --enable-rewrite
make
make install

For PHP:

./configure --with-apxs2=/usr/local/apache2/bin/apxs \
            --with-mysql=/usr/local/mysql \
            --with-mysqli=/usr/local/mysql/bin/mysql_config
make
make install

Create the PHP initialization file (not sure why the install doesn't do this...)

  cp php.ini-recommended /usr/local/lib/php.ini

For reasons unknown to me, you might want to find the include_path directive in this file and change it to:

include_path = ".:/usr/local/lib/php:/usr/local/include/php"


You will need to create an apache user using the Accounts module of the System Preferences application.

And... that's about it! Continue reading the rest of the series:

Oh, you may also want to do this as well:

Personal tools