[Second editor's note: I received a referral to another site with a step-by-step guide for compiling all three of these programs from source; I haven't used it, but it's a similar step-by-step tutorial, but it doesn't use any package files.]
Compiled and partly written by Vip Malixi with contributions from Scott Anguish, René Voorburg, Matthew Vaughn. The following tutorial is a comprehensive set of instructions for installing a new version of Apache (1.13.19), along with PHP 4.04 and mySQL 3.23.28. In order to follow these instructions, you will need to have (a) root access [detailed elsewhere on the site] and (b) the developer tools installed.
If you'd like to see how this is done, please read the rest of this article for a thorough, step-by-step guide to the process.
Here's how to install all three packages on Mac OS X v10.0, broken down into different tasks.
Step One: Preparation
- Download the following files. NOTE: Make sure you get these exact versions; others may not work with this tutorial!
MySQL: MySQL-3.23.28-1.0.pkg.tar.gz
Apache: apache_1.3.19.tar.gz
PHP: php4.0.4.img
- Run Stuffit Expander to unbinhex php4.0.4.img
- Mount image php4.0.4.img
- Copy php-4.0.4pl1.tar.gz to your hard disk
- Copy all these files to your Documents folder which is at /Users/yourusername/Documents or click on Home then Documents:
php-4.0.4pl1.tar.gz
apache_1.3.19.tar.gz
MySQL-3.23.28-1.0.pkg.tar.gz
- Open the Terminal application, which is inside Applications/Utilities
- Go to Documents folder from Terminal. Type the following at the Terminal prompt (the ">" represents the prompt, so don't type it):
> cd ~
Do you see the files? If you don't, type the following:
> cd Documents
> ls> pwd
to check if you're in the right directory: /Users/yourusername/Documents
- Unpack MySQL:
> gnutar xpfz MySQL-3.23.28-1.0.pkg.tar.gz
- Exit the Terminal and in Finder, go to your Documents folder and double-click on the resulting mySQL package.
- Apple's Installer will ask for admin password (click on the "lock" icon). Enter your password then run the installer.
- Quit installer when finished.
- Go back to Terminal application and type the following:
> su
Enter your Root password then> cd /usr/local/bin
> ./mysql_install_db
> safe_mysqld &Your Terminal will just stop (won't go back to prompt) but that's okay. You can close Terminal. I'm assuming you know how to run and use mysql. If you don't know how to create a new user aside from Root with database creating privileges, this is how. At Terminal, type the following as Root:
> mysqlInside mysql, type the following ("m>" represents mysql prompt, don't type it):
m> GRANT ALL PRIVILEGES ON *.* TO yourusername@localhost[Editor's note: The above line for GRANT ALL was broken into two lines to narrow the display width - enter it as one line! Also, please read up on database security at the mySQL web site! It's quite important for the safety of your system and data!]
IDENTIFIED BY 'whateverpasswordyouwant';
m> quit
When you're done, exit root by typing 'exit'.
Now to run mysql as you and create a new database, etc., you must do the following:
> mysql -pwhateverpasswordyouwant testStep Three: Installation of Apache
m> create database myfirstdatabase
m> quit
> mysql -pwhateverpasswordyouwant myfirstdatabase
- First turn off Mac OSX Apache. Go to System Preference-Sharing, make sure WebServer is off (buttons says "Start" instead of "Stop")
- Go back to where you placed Apache package. Do this at Terminal:
> cd ~
You'll be asked for Root password. Give it then run.
> cd Documents
> gnutar xzf apache_1.3.19.tar.gz
> cd apache_1.3.19
> ./configure --enable-module=most --enable-shared=max
> make
> sudo make install
Step Four: Installation of PHP
- Go back to where you placed PHP package. Do this at Terminal to become Root:
> su
Enter your Root password
- Next, configure PHP (the disabled pear is because your file system, HFS+ is case-insensitive, and installing pear causes errors)
> ./configure --with-mysql --with-apxs --disable-pear
In my case, I also added dBASE support, so if you want, you can type the following or add other configurations. Consult PHP.NET regarding the others:> ./configure --with-mysql --with-dbase --with-apxs --disable-pear
> make
> make install - Open the following file using at the Terminal using the Pico text editor:
> pico /etc/httpd/httpd.conf
- Do a search for 'PHP' (it's Ctrl-W; don't type the quotes!)
- Make sure the following are in there and not commented out (comments take the form of "#"), if not add them at the appropriate place:
LoadModule php4_module
You may also want to modify the following so that Apache will let you go to your PHP page without having to type the file name if it's a default
libexec/httpd/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php .php .php3
AddType application/x-httpd-php-source .phps
 DirectoryIndex index.html index.php index.php3
Step Five: Activation of Apache
- Go to Systems Preference-Network
- Create a new Location (click on Location pulldown menu and select "New...")
- Call the new Location "Local" or whatever you want, but make the following settings:
Configure: Manually
IP Address: 127.0.0.1
Router: 127.0.0.1
Leave all the other settings the way they are. Save it.
- Make sure mySQL is running (I mentioned this earlier. To check if it's running, at the Terminal, type 'mysqladmin -v ping').
- Run Apache: at System Preference-Sharing, turn on WebServer by clicking on "Start" button.
- Go to your browser, like Ominweb or (blech) Microsoft IE (can't wait for Mozilla or Netscape port to OSX), and type for Location: http://127.0.0.1 -- you should end up at Apache welcome screen.
- Your programs need to be placed in: /Library/Webserver/Documents which is accessible from Finder. Try putting in a PHP/Mysql program and see results in your browser. For example, if I place in "first.php" then at browser, you type: http://127.0.0.1/first.php
- If you put in a folder inside /Library/Webserver/Documents, then just use the name of the folder (no spaces) in the browser. Example, if folder is called "myprogs", then use: http://127.0.0.1/myprogs/first.php

