up vote 6 down vote favorite
1
share [g+] share [fb]

I'm a Web Developer who has just made the switch over to Mac. Despite all that I know and love about the Windows environment I find myself in a new mysterious place.

My question: what is the best Apache, PHP setup for a Mac developer? On Windows I've been using WAMP which was quite nice, I know Mac comes shipped with Apache 2 and PHP pre-installed. I'm just wondering if there is a better solution out there.

link|improve this question
Should be posted to ServerFault or SuperUser... – gahooa Oct 1 '09 at 17:54
feedback

migrated from stackoverflow.com Oct 2 '09 at 14:33

This question came from our site for professional and enthusiast programmers.

13 Answers

Snow Leopard comes with PHP 5.3 and a lot more pre-installed extensions than in Leopard - GD being the one that I always found hardest/most time-consuming to compile myself, but also PDO-mysql which is handy.

There's also MAMP, which is a pre-configured version of PHP, Apache and Mysql, but that hasn't had its PHP version updated for quite a long time, and development generally seems really slow. Until I installed SL though, that's what I used - I turned off the built in Apache (Under "Sharing" in preferences) and set MAMP's apache to port 80.

link|improve this answer
2  
MAMP makes life very easy. – davethegr8 Oct 2 '09 at 18:13
MAMP is great for beginners and if you want to get up and running fast. Compiling from source is always the best for seasoned web developers because you can add and remove items from the configuration as needed – ricbax Dec 10 '09 at 14:27
feedback

If you are happy with WAMP on windows, then you could try XAMP on OS X

BTW although Apple pre-installs various packages such as PHP, you will probably find that they are not the most up to date ones. I know that this was the case for PHP on plain old Leopard. I am not sure what is installed on Snow Leopard.

link|improve this answer
It's real name is XAMPP, with two 'P's. – donut Feb 23 '10 at 7:54
I use XAMPP. Works on Windows and Mac, can't go wrong. – danixd Aug 20 '10 at 15:44
feedback

On Windows you use Wamp, on Linux you use Lamp on Mac you use... guess... Mamp!

link|improve this answer
feedback

I think that the Zend Server CE is one of the better packages you can install for windows or mac. Comes with instruction caching and what not. Its what I run on my mac. It installs everything in /usr/local/zend and you don't need to worry about software updates messing up your custom apache/php compiles.

link|improve this answer
feedback

There's something to be said for learning to compile things from source all by yourself. Give yourself a weekend to build up a bunch of build scripts.

I can't tell you how valuable it is to have a bunch of scripts that will more-or-less build the environment you want and need. I actually have several, distinct, AMP stacks running on my Leopard laptop. They mirror the builds running on various client machines.

It's pretty easy to get started. On the mac, get familiar with MacPorts or Fink so you can install various dependencies. Then grab a recent apache. Build it with a prefix like --prefix=/testing/httpd. Bang on it until you can get it to compile, and you can start it up with "/testing/httpd/bin/apachectl start". Then you can start playing with compiling Apache with OpenSSL, then figure out how to build PHP (with whatever extensions you like).

It's tedious, but if you write shell scripts to do it for you, you can always come back and make minor tweaks to include any weird esoteric library you'll ever need.

Even if it never helps you with web development directly, knowing your way around the configure/make/make install dance is a skill you may as well pick up whenever you can.

link|improve this answer
feedback

You can stay up-to-date with the MAMP provided through MacPorts. They have instructions on how to install for as old as Mac OS 10.4.

link|improve this answer
feedback

There is mamp. It's has a mac like interface to.

link|improve this answer
feedback

FWIW, I work on a project that requires, among other things, memcached and postgres support.

The version of PHP 5.3 bundled in Snow Leopard doesn't have postgres support compiled in.

Installing memcached against MAMP is non-trivial -- its version of PECL doesn't work. There's a blog post which includes a link to a pre-built memcache extension binary, but it's only compatible with a single old version of MAMP.

The Mac Ports version of PHP, on the other hand, fairly trivially supports postgresql and memcached. It does not, however, have a pretty interface like MAMP -- you'll be spending some time on the command line installing and managing it.

Haven't tried XAMPP. It may be worth a shot.

In summary, if you have a simple set of dependencies -- you don't need any extensions -- and you're not comfortable on the command line, go with MAMP.

If your project has many dependencies (multiple PECL extensions, etc.) Mac Ports may be your only option.

link|improve this answer
feedback

If you're interested in rolling your own MAMP development environment (perhaps the Apple-supplied PHP 5.3 is missing some things you want) I wrote a step-by-step tutorial of my installation at http://www.teamonetickets.com/software/howto-setup-php-apache-mysql-dev-environment-on-snow-leopard.html

link|improve this answer
feedback

Another option is to run your web environment(s) in virtual machines. You could use VirtualBox or similar to do this for free (assuming licensing concerns are taken care of). I've started doing this although with a dedicated server running virtualization software (Xen on Linux) and it's wonderful.

It's certainly different from the other options presented. One concern is if battery life is important -- running a VM would likely consume more resources and reduce battery life. Otherwise, assuming enough resources (memory) is available, it's a great way to keep your separate web sites as completely separate environments.

Just a thought. I know it's not quite what you asked.

link|improve this answer
feedback

While the included stuff is nice and things like MAMP work well I have always liked to roll my own so I can be in control of updates and changes.

Even thought it was written for Leopard Sean's article is a good guide to getting everything setup. Doing this has allowed me to change the installed PHP quickly and easily as necessary.

link|improve this answer
feedback

MAMP is ok. It works, but I would prefer to get the default setup working before installing something over the top of it that mucks everything up. I had a really hard time trying to get PHP and MySQL installed on Leopard, but now that Snow Leopard is out, it makes it a lot easier. My recommendation is start with a fresh install of Snow Leopard and find a good tutorial (or separate tutorials) on how to set up Apache, MySQL, and PHP.

link|improve this answer
feedback

I think XAMPP is the best one as i am using it from a quite long and i only have 1 GB RAM and developed a lot projects like facebook twitter and similar .... works fine ... the best XAMPP

link|improve this answer
feedback

Your Answer

 
or
required, but never shown