UPDATED: Install PHP 5.2 stack from source on Mac OS X 10.6 Snow Leopard using Homebrew
I've updated the instructions to build a nice clean and fast PHP 5.2 stack using my own build scripts and the homebrew build system.
All software is installed into /usr/local for easy management and while it works with the included OS X Apache and libraries where possible it is installed in such a way that system updates from Apple don't clobber anything.
I use this stack as my local PHP and Drupal development environment.
The instructions are rather verbose but if you don't really care how it's done I've included a build script below that will do everything except the final configuration work.
NOTE: You require the Apple Development tools (XCode, etc.) installed to build software from source.
To run this quick install script, launch Terminal.app, copy the following block of code and paste into the terminal to create the script:
cat <<EOF > install-php52.sh
#!/bin/bash
if [ -d /usr/local ]; then
echo "moving existing /usr/local to /Users/`whoami`/local.bak"
sudo mv /usr/local ~/local.bak
fi
sudo mkdir /usr/local && sudo chown -R `whoami` /usr/local
curl -L http://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C /usr/local
brew install git
cd /usr/local
git init
git remote add origin git://github.com/mxcl/homebrew.git
git pull origin master
git remote add boztek git://github.com/boztek/homebrew.git && git fetch boztek
git checkout boztek/php52 && git checkout -b working
git pull --rebase origin master
brew install php52 --with-mysql --with-apache
EOF
Then to run the script copy and paste this line:
chmod u+x ./install-php52.sh && ./install-php52.sh
Ain't git grand?
It looks incomplete
/usr/local/bin/php-cgi is missing and is needed for fcgi for nginx and others.
This is a little outside the
This is a little outside the scope of my formula which is focused on installing local tools for PHP web app development on snow leopard but I will try to look into it.
Does Snow Leopard ship with php-cgi as part of its 5.3 install?
Also, feel free to submit a patch.
http://github.com/boztek/homebrew/tree/php52
Hi Boris, i tried a half day
Hi Boris,
i tried a half day to run your script over the instructions but it dont work. Then i wants to try your script but there no file attached.
I get this 2 Failures:
Error: Failure while executing: make prefix=/usr/local/Cellar/git/1.7.0.2 install But I installed the git-core.1.7.dmg then the script worked after the 1st. Failure. But after the second it stops.
Error: Failure while executing: ./configure --prefix=/usr/local/Cellar/jpeg/7
Thank you in advance for help
greetings Alex
Yeah dude, you didn't follow
Yeah dude, you didn't follow the step that said "Install Xcode".
Please try with updated quick install script instructions above
One thing to check though, do you have XCode and all the Developer tools installed?
You are right. At the first
You are right. At the first time i make some mistakes than i reinstalled my OS X SL. The second time i forget to install XCode. But at the third i make all things right and it work great.
Thank you a lot.
Greetings Alex