Home arrow Site Administration arrow Page 5 - Building Apache, MySQL, and PHP on Mac OS X

Making PHP - Administration

Apple's new operating system, Mac OS X, has a UNIX at it's core. What can you do with that? Make a killer development box that includes runtime environments for PHP and MySQL! This article runs you through all the steps for building Apache, MySQL, and PHP on your Mac OS X-based box.

  1. Building Apache, MySQL, and PHP on Mac OS X
  2. Prerequisites
  3. Making MySQL
  4. Making WebDAV
  5. Making PHP
  6. Caveats
By: Lucas Marshall
Rating: starstarstarstarstar / 11
May 21, 2001

print this article


The last step is to get PHP set up.

% cd .. % gnutar zxf php-4.0.5.tar.gz % cd php-4.0.5
Now PHP is decompressed and ready to be configured.

% ./configure --with-mysql=/usr/local ¬ --with-apxs=/usr/sbin/apxs \

The --with-mysql option tells the configure script that we want to use the MySQL libraries that were installed with MySQL instead of the ones that come with PHP. The --with-apxs option does the same thing it does in the mod_dav configuration, tells the configure script that we want PHP compiled as a DSO, and the --with-zlib option tells the configure script where to find the zlib libraries it needs (These are included in Mac OS X).

Running the configure script strangely breaks one file in the distribution, main/internal_functions.c. In that file, some of the #include lines are run together into one line, and have the letter "n" separating them.

You can edit this file manually to fix this, but I've made a Perl script that will do the trick, if you'd rather use it.

Execute the following commands to use my script.

% wget http://www.devshed.com/article-images/fix_php.pl
% chmod +x fix_php.pl

This will get the script and allow you to execute it, and

% ./fix_php.pl
will run it, fixing the problem.

% make
% sudo make install

These commands will compile, install, and enable the PHP module.

You're not done yet, you need to tell Apache to use the PHP module for all files with a .php extension. Edit the Apache configuration file:

% sudo pico /etc/httpd/httpd.conf
and remove the #s from the lines that look like this:

# And for PHP 4.x, use:
#AddType application/x-httpd-php .php
#AddType application/x-httpd-php-source .phps

so they end up looking like this:

# And for PHP 4.x, use:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

and restart your Apache server.

% sudo apachectl restart
Now, to test your PHP setup, you'll need to make a PHP script. Type the following:

% pico /Library/WebServer/Documents/phpinfo.php
and paste this in:

<?php phpinfo(); ?>
Save and exit, then open up your web browser and go to http://localhost/phpinfo.php If everything is working correctly, your browser will display a nicely formatted page with info about your PHP installation, and we're done!

>>> More Site Administration Articles          >>> More By Lucas Marshall

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Coding: Not Just for Developers
- To Support or Not Support IE?
- Administration: Networking OSX and Win 7
- DotNetNuke Gets Social
- Integrating MailChimp with Joomla: Creating ...
- Integrating MailChimp with Joomla: List Mana...
- Integrating MailChimp with Joomla: Building ...
- Integrating MailChimp with Joomla
- More Top WordPress Plugins for Social Media
- Optimizing Security: SSH Public Key Authenti...
- Patches and Rejects in Software Configuratio...
- Configuring a CVS Server
- Managing Code and Teams for Cross-Platform S...
- Software Configuration Management
- Back Up a Joomla Site with Akeeba Backup

Developer Shed Affiliates


Dev Shed Tutorial Topics: