Get your FREE 30 page Developing SOLID Applications guide!

First Glance: Apple’s Snow Leopard

Out Of Date Warning

Languages change. Perspectives are different. Ideas move on. This article was published on August 28, 2009 which is more than two years ago. It may be out of date. You should verify that technical information in this article is still current before relying upon it for your own purposes.

For those who like the newest in development tools, Apple has surely delivered with the Snow Leopard operating system upgrade.

Apple has compiled PHP 5.3, including many of the extensions they forgot in the PHP 5.2.x version included with Leopard. This includes GD, and the MySQL Native Driver (mysqlnd) that is available in PHP 5.3. They’ve also compiled Subversion 1.6.2, and Apache 2 is included as well (2.2.11).

It does not appear that MySQL is included with Snow Leopard, though. PHP also does not have a configuration file, resulting in a warning being emitted by PHP about the timezone not being set. These are relatively easy problems to correct, though I have not tested the full MAMP stack for compatibility with products such as WordPress or web2project.

Here’s a copy of the Apple ./configure line for PHP:

ScreenShot

Write better object oriented PHP today.

Object oriented programming always leaves you with a headache. What if you could master it instead?

Get the book now! »

Kyle Decot (@skateparks) wrote at 8/30/2009 3:30 am:

Exactly how do you fix the timezone issue? I can’t seen to figure it out

Brandon Savage (@brandonsavage) wrote at 8/30/2009 6:06 pm:

Kyle, you’ll want to copy the distribution php.ini file to the /etc directory and then edit the line date.timezone to your appropriate timezone.

See the timezone database (http://us3.php.net/manual/en/timezones.php) for the correct way to specify your timezone.

Dave wrote at 8/31/2009 5:10 am:

Hi Brandon, sorry for the stupid question, but where is the distribution php.ini file located? i tried to copy the php.ini.default file in /etc to php.ini but this had the knock on effect of disabling php altogether..

thanks

Brandon Savage (@brandonsavage) wrote at 8/31/2009 8:18 am:

For me, there was a php.ini file located here:

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

I copied it (rather than moving it) in case I ever wanted to replace it.

quelhas wrote at 9/1/2009 8:50 am:

Anyone tried to install APC (Alternative PHP Cache) extension? I’ve tried some of the most recent versions but i got some strange and different compile errors while performing “make”. Maybe there might be some ./configure flags missing. Anyone?

Brandon Savage (@brandonsavage) wrote at 9/1/2009 9:09 am:

I haven’t, but to be fair I typically don’t install APC on my development machines.

Make sure you’ve upgraded your Xcode installation (it’s on the Snow Leopard disk) because that’s not automatically installed, even if you had it installed for Leopard.

Emehrkay (@emehrkay) wrote at 9/2/2009 12:19 pm:

This is the first site that I’ve come across that really talks about Snow Leopard and PHP 5.3.

The timezone error kinda difficult to fix. The doc page for timezones says to add it in this format in the ini “America/New_York” which didnt work for me in the ini, it did work when using thedate_default_timezone_set() function. What worked was to define it like such in the ini:

date.timezone = Etc/GMT-5

Tady Walsh wrote at 9/2/2009 2:43 pm:

Hiya Brandon,

I posted this on the Apple and WordPress Forums today:

http://wordpress.org/support/topic/306878

But for lack of having a blog of my own, I thought you might like to re-post it. It answers all these points and more of the MySQL install.

Cheers,

T

Richard wrote at 9/2/2009 3:53 pm:

@Dave

His may have been in /usr/local/php5/lib/php.ini-recommended, but mine was /etc/php.ini.default from a fresh install of Snow Leopard.

Brandon Savage (@brandonsavage) wrote at 9/2/2009 3:57 pm:

Tady, your wordpress installation problems probably stem from the fact that WordPress doesn’t officially run on PHP 5.3 yet.

Jesse wrote at 9/17/2009 6:56 pm:

I upgraded to SnowLeopard and it killed my MySQL, PHPMYADMIN and APACHE. I think the PHPMYADMIN doesn’t work just because APACHE no longer functions. So, I installed MAMP. This gets it working, but I think it isn’t the same. I want my native Snow Leopard Apache and MySQL install to function on it. Realistically, the Apache seems to be my biggest problem. How do I reinstall this from scratch? From the install disc?

Richard wrote at 12/4/2009 11:30 am:

>> For me, there was a php.ini file located here:

>> /usr/local/php5/lib/php.ini-recommended

I just received a new iMac with Snow Leopard. I see references to php being in:
“usr/local”
Within my root level’s directory, “usr” there is *no* php5 (unlike my Powerbook with Tiger). [ even using TinkerTools to turn “hidden” files visible ]
I also read online that that is where mysql should be.
Why would I have no “local” directory? – and where else would php and/or mysql be?
Many thanks for any guidance you can provide. —richard

Lloyd Budd (@lloydbudd) wrote at 12/11/2009 11:02 pm:

Richard, Apple should not install anything to /usr/local . Possibly, Brandon did his own installation / upgrade of PHP at some point?

“The /usr/local hierarchy is for use by the system administrator when installing software locally. It needs to be safe from being overwritten when the system software is updated. It may be used for programs and data that are shareable amongst a group of hosts, but not found in /usr.”
http://www.pathname.com/fhs/pub/fhs-2.3.html#USRLOCALLOCALHIERARCHY
http://hivelogic.com/articles/using_usr_local

/etc/php.ini.default is the correct place for it, and the PHP lives at /usr/lib/php/ as one would expect.

WordPress already supported PHP 5.3 before 9/2/2009.

Lots of great information here otherwise.