|
Most web applications we develop are based on OSX, Apache2, MySQL, PHP5 and Propel. Unfortunately the versions bundled with OSX are not usually kept current by Apple or are bare bones, so it's up to us to load the necessary versions ourselves.
Installing MySQL
The Community Edition of MySQL is available as a free download.
As of this time, it's best to stay with the 5.0 release, rather than 5.1, as word is that it was rushed out and not fully vetted.
If MySQL is not automatically starting at system boot, see http://blog.tomatocheese.com/archives/2007/11/1/migrating_mysql_to_mac_os_x_leopard/
Installing PHP5
The Entropy PHP Apache Module distribution compiled by Marc Liyanage is invaluable. It contains a large number of popular PHP extensions, which make it much more versatile than the bare bones PHP included with OSX.
Clint has also documented some pitfalls he's run into during install.
Setting shell environment paths
Since now there are multiple copies of PHP and MySQL installed on the same server, it's useful to set our environment paths so that, when using Terminal, the binaries we installed above are called. Otherwise the Apple-installed versions (we are not using) would be called, unless we used the full path to the binary every time. Setting the shell environment paths to the versions of PHP and MySQL we are using avoids confusion, like "why isn't mysql running?" Ah... but it is.
Paths may be customized by creating a user shell profile. We use the bash shell, so:
> pico ~/.bash_profile
and add one line at the end:
export PATH=/usr/local/mysql/bin:/usr/local/php5/bin:$PATH
Open a new Terminal window (shell) for these changes to be recognized.
The bash profile will make the shell look in our new mysql and php5 bin directories first when looking for an executable. If it's not found, it continues down the search tree, the pre-existing $PATH .
You can always tell which instance of a binary is being used by typing, ie:
> which pear
which displays the full path to entropy distribution of PEAR we installed above.
/usr/local/php5/bin/pear
Setting the MySQL root password
After setting your environment paths, be sure to set the MySQL root password. This is done from the command line:
shell> mysqladmin -u root password "newpwd"
shell> mysqladmin -u root -h host_name password "newpwd"
Updating PEAR
PEAR is a framework and distribution system for reusable PHP components. It's good to be sure they are at their current, newest versions.
> sudo pear upgrade-all
Installing Propel
If you do not know what Propel is, you probably do not need to install it.
If you are a developer you should really really get to know it. Propel is an Object-Relational Mapping (ORM) framework for PHP5. It allows you to access your database using a set of objects, providing a simple API for storing and retrieving data.
To install the current version of Propel on a production box do the following:
> sudo pear channel-discover pear.propelorm.org
then...
> sudo pear install -a propel/propel_runtime
|