PHP 5.3 for OS X 10.6 one-line installer

Apple computers and OS X are quite common here at Liip (and as developer machines. But while OS X comes with a not-too-old PHP installation, it nevertheless doesn’t have everything we need (for example the infamous intl extension) and it’s not that easily extendable with self-compiled extensions.

The first reaction to that situation was usually to install one of the many available solutions to get everything we need. Like MAMP, XAMPP or install it with a package manager like homebrew or MacPorts or even compile it by yourself. That usually worked, but as a consequence we had a very heterogenous setup and for every new Liiper we needed to set that up and it usually took ages. And then came this fancy new extension and we had to invest quite some time to get it set up on the different installations.

Our friends at took this very dissatisfying situation in their own hands, forked the build-entropy-php script from Marc Liyanage’s great entropy work, extended and adjusted it to their (and our) needs. They also built a nice packager and installer around and finished the “install this and you’re set in 5 minutes” procedure.

People at Liip started using the package, we added more extensions we needed and one day we decided, that this is the only officially supported way to get PHP on your Apple computer. And it was a very good decision, people getting a new Mac now have a recent and full blown PHP installed in less than 5 minutes.

Enough, talking, want to try it out for yourself? Go to and follow the instructions. It’s really copy&pasting one line into your shell.

The package only installs PHP into /usr/local/php5, it uses the “built-in” apache server and leaves the shipped PHP alone. It also doesn’t include MySQL or PostgreSQL or any other server software, you still have to install those by yourself. But it comes with all the extensions needed to access those servers. See the phpinfo() output to see what all comes with it.

We also ship Liip-recommended php.ini settings (for developers, not for production) so that we can make sure, that everyone is using the same settings.

If you want to build your own distribution (because you want to host that internally or have different extensions), everything needed to do that is on github. build-entropy-php is the stuff needed to actually build PHP and all the needed extensions and libraries (if you just want your own custom-built php, that’s all what you need). php-osx are the scripts needed to build the tar for the package, build the webpage and upload everything. And the packager is the script needed for downloading and installing the package (written mainly by and in python)

The website runs completely on S3. Since Amazon made it possible to host your static website on S3, we can provide such a service without having to run a machine somewhere. As a benefit of this, it will be highly reliable, I just hope the data transfer bill doesn’t kill us :) If you want to provide your own package, you don’t need S3, it should run on any server which can deliver static pages.

And as a last remark: We can’t provide end-user support for this. If you don’t know what a shell is and how to edit a configuration file, this is may be not for you (but you actually don’t have to edit a configuration file in 99% of all cases). We have it running on dozens of machines and it runs fine for us. If it doesn’t for you, it most certainly is an error on your side. Pull Requests are of course always welcome and you can nevertheless use the github issues page for filing bug reports.

Thanks to for all the work they did on all the infrastructure needed for this and for contributing this back to the community. It will certainly help a lot of PHP developers with OS X 10.6 to get a decent PHP up and running within minutes.

PS: One thing I forgot to add: You don’t need Xcode installed. It’s nowadays a hefty 4 GB download with using 10 GB diskspace (default installation) and also not free anymore, if you’re not an ADC member.

PPS: It only works on a 64bit-capable system. This means not on very old hardware with Intel Core Duo and Intel Core Solo processors (see for the overview). If anyone wants to make it work on those systems too, please tell me how (I tried, but didn’t came up with anything running in a decent amount of time)

PPPS: We have setup a twitter account for the latest news and updates. Follow @php_osx.

Actually, adding extensions (even normally bundled ones) to the stock Snow Leopard PHP is quite easy:

1) Download the source tarball of php and unpack it

2) cd into ext/name_of_the_extension (like ext/intl in your case)

3) run phpize

4) run ./configure with appropriate flags

5) make install

Then you just enable the freshly built .so file in your php.ini and you are done. This is, at least for me, much more convenient than replacing all of snow leopards php as that is bound to case problems on OS updates (been there, done that)

With mamp and xampp, we should add WebStart
always uptodate ‘on the lip’ at

Sure, that works most of the time, but if you have to support approx. 40 mac installations and half a dozen extensions, then it’s way too much overhead, if everyone has to compile it by himself. And then you’re still not sure, that all have the same version with the same config-options.
And especially ext/intl is a bitch to install ;) (maybe it works as you described, didn’t test it, but many people have problems with installing it)

Plus you don’t even need the developement tools from Apple, which are getting bigger and bigger.

And we don’t replace the binaries shipped by apple, we install everything into /usr/local/php5

So what’s the problem really with MAMP? I use it since a few months and I am very happy with it…

There’s nothing wrong with MAMP, it’s just that we don’t have it under our control (for adding extensions, which are not in MAMP, for example) and we wanted to use the shipped apache.

Didn’t work for me – looks like wrong version which would be very surprising:

httpd: Syntax error on line 116 of /private/etc/apache2/httpd.conf: Cannot load /usr/local/php5/ into server: dlopen(/usr/local/php5/, 10): no suitable image found. Did find:nt/usr/local/php5/ mach-o, but wrong architecture

Do you have OS X 10.6? Or an older version? Or something else, which could be not usual?

Brand new install of Snow Leopard updated to 10.6.7 (this morning)

Really strange, we tested it just yesterday with a clean OS X 10.6.7 installation.

Is it maybe not the stock-apache? But if you say, it’s a brand new installation, it has to be ;)

What does
$ file /usr/local/php5/
$ file /usr/sbin/httpd

tell you?

It should be

/usr/local/php5/ Mach-O 64-bit bundle x86_64


/usr/sbin/httpd: Mach-O universal binary with 3 architectures
/usr/sbin/httpd (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/sbin/httpd (for architecture i386): Mach-O executable i386
/usr/sbin/httpd (for architecture ppc7400): Mach-O executable ppc

$ file /usr/local/php5/
/usr/local/php5/ Mach-O 64-bit bundle x86_64


file /usr/sbin/httpd
/usr/sbin/httpd: Mach-O universal binary with 3 architectures
/usr/sbin/httpd (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/sbin/httpd (for architecture i386): Mach-O executable i386
/usr/sbin/httpd (for architecture ppc7400): Mach-O executable ppc

aren’t there snow leopard installations on older hardware that still use 32bit? In that case, should be universal I guess.

yep, that came to my mind as well. never heard of any problem ’cause of that, but it’s of course possible. Maybe we can add that, or just exclude older hardware ;)

Yeh – it’s the very first Intel MacBook Pro. It must be running in 32 bit.

Howard: Can you tell me, what
system_profiler | grep ‘Processor Name’
outputs on your machine?

I’m trying something ;)

I’m away from that machine today but it’s a Core Duo (not a Core 2). I’ll check for definite tonight. I gave up and installed Ubuntu anyway – OSX is too much grief for development :)

I added now a checked for 64bit capable systems. It doesn’t download the whole package, if your system is not 64bit capable

Never had much problems with using pecl to install php modules using homebrew copy of PHP.

As said, there’s nothing wrong with homebrew, but if you have to support dozens of PHP on OS X installations and they all need “exotic” extension, you don’t want everyone compiling that by yourself, that’s gonna be a lot of wasted time in the end. And usually also frustration, as there’s certainly the one or the other who gives problems

Can we expect to see APC support soon?

Also, mssql support is included, but not the mssql PDO driver?

Gordon: APC is already installed, just not enabled by default, see the APC section in for the details

And I see what I can do about the pdo_mssql driver

Ok, that was easy, pdo_dblib (for accessing MS SQL servers) is now added and available for download.

This is Wonderful stuff! I have tried and failed to get intl installed in the past. This worked great.

One question; the version of php that Apache sees is this new /usr/local/php5/bin/php version, but bash is still seeing usr/bin/php:

$ which php
-> /usr/bin/php

How do you recommend I solve this? symlink /usr/bin/php to point to /usr/local/php5/bin/php ? Or do you do something else?


add php to your search path (in your ~/.bash_profile file):

I’ll add that to the php-osx web page later

Thanks! That’ll work!

Hey, this worked great. Appreciate all the time and effort it took you so I could save a lot of time and effort.

Just one question. Suddenly all my pages have tons of warnings. It’s great for checking my code and debugging, but is there some simple way to turn that off?

Figured it out. The .ini files in the php.d directory had the xdebug config. I set it up to output the errors to a file that I tail -f during development. That way, my screen display stays clean but I can still view the errors.

Thanks again.

Pretty slick! But is anyone else seeing zend_mm_heap corrupted messages?

I have installed this distribution with success!
Is it possible to use OCI8 with this distribution?


Hi. We would also be interested to run this with OCI8, any comment about that? Someone?


We have no need for OCI8 so someone has to provide patches. I never installed those and have no experience with it, so this doesn’t look like an easy way for me. But for anyone with the right knowledge, this shouldn’t be too hard.

Can I use your one-step install to install on Snow Leopard Server? It seem to me most people have been installing on their local machines.

Do I need to make any explicit changes to the httpd.conf file as you do with the entrophy build?


I guess it should run on Server as well, but I can’t test that, since I don’t have that.

DId you ever try to add the ImageMagick extension? It is the only one I need that is not installed. I figured that it would be fairly trivial to add, but I was wrong. No matter what I do, on a clean install of 10.6, I keep running into conflicts and errors.

Not all the extensions that were on the original entropy from the past are on this version for 10.6. The mycrypt extension was one that i noticed not present anymore.

Hi. Everyone who wants to have other extensions included, please add a report at

Otherwise we can’t keep track of them

Even better is of course to provide patches ;)

thanks a lot for your fantastic work. Unfortunately it doesn’t work on MOSX Server 10.6.x. The installation procedure works as expected, but it is impossible to get it up and running.

Any clues?


Yeah, no love on Mac OS X Server 10.6.7 either. It looks like the script doesn’t create a symlink for /etc/php.ini to /usr/local/php5/lib/php.ini, nor does it properly mod /etc/apache2/httpd.conf to point to /usr/local/php5/

PHP5 on Mac OS X Server 10.6.7 also has ‘–with-mysql-sock=/var/mysql/mysql.sock’ as a build option, so there will be problems there.

Also it has ‘–enable-zend-multibyte’ enabled — that’s needed for zend framework compatibility.

Weird Question: could the installation / runtime directory be changed to /Users/[Active User]/Server/ or something in the user space?
If I could get a stack to install, I already know that by changing the ports everything runs on ( port 80 is a no go, has to be above Reserved ports) I can in theory run without admin privileges.

Is this possible with your implementation. If not does anyone have an idea how to accomplish this.

With 5.3.8 officially released, when can we expect the installer to be updated?

Is the new version updated to work with MOSX 10.6.x? I hope so, but either way, you rock for doing this.
Patching php is so tedious. :/

After the instalation it doesn’t seem to work. I observed that in

I have two folders: php5 and php5-20111115-115202

Well I thing that that the httpd is not correctly
this line
LoadModule php5_module libexec/apache2/

I quess it is pointing to the wrong installation.
Any ideas, what should I change?

Change that line to

LoadModule php5_module /usr/local/php5/

and restart apache

That’s great thanx!

I was reading your article and I found AMPPS :
and MAMP :

Can anyone tell which is better and why ?

Got it installed and working on 10.6.8 server after manually editing /etc/apache2/http.conf (god, I hate Server Admin) and linking /etc/php.ini into /user/local/php/lib.

There was a moment of panic when it was looking for mysql.sock in /tmp and all my websites went down… :-)

So grateful to find this after fighting with recompiling PHP.

I did the install on Mac OSX Server 10.6.8 and it seemed to happen without error. However now when I try to access a PHP file by browser it downloads the file rather than execute it. Any ideas why?

@Wayne, check to make sure that PHP is still turned on in /etc/apache/httpd.conf.

You may have a script using short php tags ( <? ). You need to make sure that php.ini allows short tags (short_open_tag = on) or change your scripts to use long open tags ( <?php ).

You could create a dummy PHP document with long tags and access it via your browser, like:

<?php echo “It’s working”; ?>

Need help getting PHP 5.3 install working.

Used terminal to install PHP 5.3 on a mac running 10.6.8. Like anton, I ended up with two folders: php5-20120203-085138 and a php5 alias. Corrected line to read “LoadModule php5_module /usr/local/php5/”. Php still not working.

I also have Wayne’s problem of php files downloading instead of executing in the browser. Php and apache not activated before on this machine.

Virtual hosts work fine, but not php. Would someone please tell me what changes I need to make to get this installed right? Now I’m not sure which files to edit, and where and what to edit the files to. Thanks for any help.

Hey James,

The problem in my case turned out to be that shortcut PHP tags were turned off and the pages in question used <?… rather than <?php…

In your case I’d first make sure that the PHP line in httpd.conf is not commented out. Google ‘turn on PHP’ for blow by blow instructions.

Thanks for your suggestions, Wayne.

I went through php files last weekend and didn’t find any short tags. Tried many variations, but I finally got everything running by doing a (yet another) fresh php install and repairing permissions. Don’t know why, but this seemed to work. Thanks for responding.

One problem I found installing from the one-line installer was that the liip.ini was overriding the php.ini mysql socket location. PHP was then trying to use /tmp/mysql.sock instead of /var/mysql/mysql.sock

That may not be an issue for those that have built mysql from source, but if you run an Apple installed version, it could cause all sorts of problems.

If you find that changing the default sockets in php.ini isn’t doing anything, hunt down the location of your liip-developer.ini file. With the one-line installer, it is in /usr/local/php5/php.d/99-liip-developer.ini

Thanks so much for this package. I’d been tearing my hair out trying to get MAMP and then BitNami to work for me. I have however run into a problem that I’m sure must have been solved many times… I’m trying to install Composer but I’m getting an error that detect_unicode needs to be disabled in my php.ini. So, I tried adding the line to the end of the main php.ini file and restarting Apache. Didn’t help. So next I created a composer.ini file in the php.d file which simply had the detect_unicode = Off line in it. Restarted. Still not working. Am I missing something obvious?! Thanks.

Ignore my last post! I’d forgotten to restart my machine in order for changes in my .bash_profile to take effect and as such the command line was still using an old version of php…

Thanks for the great PHP installer. I was falling deeper and deeper into a pit trying to get Symfony 2 installed on my Mac. The biggest pain was the intl module. I’ve finally passed the check.php now.

For those wondering about MAMP, it’s great as long as you don’t use Python and MySQL. It doesn’t install MySQL where Python expects to find it. After a fighting for a couple of hours with it I gave up and went back to a standard install of MySQL.

When i rund PHP from browser it works, when i run it from command line (Unit Tests…) it is nightmare, nothing works!!! Extensions which should be loaded are not loaded!!! I am disappointed!!! In windows i need 2 minutes to setup everything and here 2 months!!!!

Hi Zoran

So why don’t you go back to Windows then? ;)

Anyway, I can’t help you much without more information. One thing to notice is, thatthe php binary is in /usr/local/php5/bin/php, you have to either adjust your scripts or the PATH variable to make sure, that they take the right binary and not the one by apple in /usr/bin/

Also it is not clear that the loaded php.ini file is over written by the
/usr/local/php5/php.d/99-liip-developer.ini. ? ( not sure now if that’s the right file) but it would be nice to update the info on your page >_

Also it is not clear that the loaded php.ini file is over written by the
/usr/local/php5/php.d/99-liip-developer.ini. ? ( not sure now if that’s the right file) but it would be nice to update the info on your page >_<

Thanks for the script!

The packager page says that the script works with OS X 10.8 Mountain Lion, so I tried running it under 10.8.2. I got a few errors along the way, but nothing serious-seeming until the end, when it said this:

Executing post-install script /tmp/5.4-10.8-frontenddev-post-install
rm: /usr/local/php5: is a directory
cp: /usr/local/php5/lib/php.ini-development: No such file or directory
Restarting Apache
httpd: Syntax error on line 500 of /private/etc/apache2/httpd.conf: Syntax error on line 8 of /private/etc/apache2/other/+php-osx.conf: Cannot load /usr/local/php5/ into server: dlopen(/usr/local/php5/, 10): no suitable image found. Did find:nt/usr/local/php5/ no matching architecture in universal wrapper

I don’t know enough to know whether that’s a problem with my setup, or an OS mismatch, or what. I know you said you don’t supply support, so no problem if you can’t help with this, but figured it couldn’t hurt to ask.

I should note that in my /usr/local/php5, there’s a file called “entropy-php.conf”, dated Sept. 24 2006. It’s possible that I had previously installed PHP using the old package (on a previous machine, but it may’ve somehow gotten copied over to the new machine when I upgraded); if that’s likely to be the problem, then no need to spend time troubleshooting the above error messages.



I have a macbook OS X 7.5 64bit and want to install Joomla to add a blog to a website. Joomla requires 5.3 version of PHP instead of 5.2. I tried your one line install but it asked for a password. I don’t have a password, there is none, but a null response doesn’t work.

Any idea what I should do?


@Richard you need to provide the password for your computer or github account I don’t remember which, just follow the prompts and trust them, if not then follow the instructions to download it manually .
Hope this helps

I’m sorry, I’m not technical. My Pc doesn’t have a password. Why do you think it should? What is github? Should I know that?

you are on a mac correct? you didn’t set up a password for your mac?

No, why should I? It is a home pc. I turn it off and turn it on and it doesn’t ask for a password.

If I were to do it manually, wouldn’t it still want a password via the sudo command?


Also, (sorry these are not together) another site said I had to enable apache to use PHP. Is that correct?


Richard – Of course you have a password on your Mac (no one I know calls their Mac a PC, BTW). No MAC operates without an administrative account. A password is required every time you upgrade your account or install new software although you may have set your account for startup to auto-log in.

@Richard if you are that new to development I suggest you use MAMP
good luck mate!

Just so you know, I don’t have anything to do with liip or
I’m just a fan of their script :)

Thanks for helping out Tony.

ToyGuy: I agree with Tony, if you’re not used to the commandline or the inner workings of an Apache/PHP setup, i’d also recommend something like MAMP or XAMPP for you.

I do wish to thank all of you. I looked up MAMP and it looked like it was for creating a web server. That’s way out of my league. I don’t want to run Apache on a personal Web Server.

My wife has a website on Justhosts and creates the web pages for it on her Mac using OpenOffice. A friend of hers said she needed to install Joomla which would add the blog to her OpenOffice pages. Unfortunately Joomla wanted PHP 5.3.

Is there an easier way to do what I wanted that building my own web server?

Thanks again for everyones help.

I didn’t like how I described what I need above.

The only reason all this came about is my wife wanting to add a blog to a web site hosted by justhosts and built on a Mac using OpenOffice.

Thanks again,


I think there is a basic misunderstanding here. PHP is a webserver plug-in/add-on/extension. You need it installed where your web server is.

@Richard, if you want to test a Joomla install on your computer, than you need a web server to do it, that is what MAMP is a local web server.
Your wife’s site is on a remoter web server, if it need PHP5.3 to run you need to take that up with Justhost.
Try Google it does wonders for questions :)

Thanks for the information. I finally understand what the issues are. I’m not sure of the resolution but I do appreciate everyone’s input.

This is great!

There is a mention in the comments above about MS SQL support, but I am confused by it. Is there an easy way to add support for MS SQL PDO? I’d like to add a configuration option for using freetds (I think), but I have no idea how to go about that.

Thanks again for a very helpful script!

Nick: It should be enabled by default and called pdo_dblib, don’t use see it in phpinfo()?

Great job guys!

Is there any reason why this binary php package should not be used in a production server?

Today I successfully installed the 5.5 version of the binary into a test server running OS 10.8.5. I disabled the “99-liip-developer.ini ” file so as to use the standard php.ini, and the server seems to be running fine. Also, this binary includes some extensions (e.g. intl & opcache) that I have been unable to install myself.

So this binary seems to solve my problems. However, I noticed that the developers of this package created it for development purposes, which makes me think that I shouldn’t use it for a production site. What would you advise?

Just installed php-5.5.11 on Snow Leopard 10.6.8 with Apache 2.4.9… I get this error:
httpd: Syntax error on line 453 of /usr/local/apache/conf/httpd.conf: Syntax error on line 6 of /usr/local/apache/conf/extra/httpd-php.conf: Cannot load /usr/local/php5-5.5.11-20140405-142606/ into server: dlopen(/usr/local/php5-5.5.11-20140405-142606/, 10): Library not loaded: /usr/local/php5/lib/libtidy-0.99.0.dylibn Referenced from: /usr/local/php5-5.5.11-20140405-142606/libphp5.son Reason: image not found

Problems with libtidy? Can you help me? Thanx a lot!

Just installed it on a fresh copy of Snow Leopard. Works for me.

Does /usr/local/php5/bin/php -v work? Does the file in /usr/local/php5/lib/libtidy-0.99.0.dylib exist?

Hi! I answer yes and yes to your questions. I need to recompile apache in order to upgrade openssl to 1.0.1. I compiled apache 2.4.9 the same way I compiled previous versions but it do not work with your php. Previous version 2.2.15 (I compiled, too) works fine with your php, also the last 5.5.11. Still investigating but can’t understand…

Just for my information… is it possible your php package is not good with 2.4.x version of Apache? I made some check and found I have no problem at all using 5.3.x, 5.4.x and 5.5.x packages with OS X 10.6.8 built-in Apache and also with my self-compiled apache 2.2.x but there is no way with Apache 2.4.x. Is it my fault or what? Thank you so much!

Struggling with the new php v5.5.13 on a MacPro running 10.6.8. All previous versions were fine, but installation leads to tons of errors in the logs and finally an Apache crash – where it stops listening. Had a few black screens of death too. Posted to apple support the entire console, but too much to load here. 10.6.8 is pretty virgin, no strange extensions and has worked with all the php v5.2, 5.3 and v5.4 installations. Still running Apache v2.2

Anyone else having crashing problems? Had to restore to v5.4.16 to recover stability.

I’m trying to install PHP 5.5 onto Mac OS X 10.9.4 on a MacBook Pro Late 2008 (Unibody Core 2 Duo).

When I “curl -s | bash -s 5.5″ … it outputs …

Your version of OS X (10.9) is not supported, you need at least 10.6
Stopping installation…
If you think that’s wrong, try
curl -o -s | bash force

If I try the force option, it installs 5.3. So I dug into the file and executed “sudo /usr/local/packager/ install 5.5-frontenddev” … which installed 5.5 but when I “sudo apachectl configtest”, I get …

httpd: Syntax error on line 501 of /private/etc/apache2/httpd.conf: Syntax error on line 8 of /private/etc/apache2/other/+php-osx.conf: Cannot load /usr/local/php5/ into server: dlopen(/usr/local/php5/, 10): Symbol not found: _libiconvn Referenced from: /usr/local/php5/lib/libintl.8.dylibn Expected in: /usr/lib/libiconv.2.dylibn in /usr/local/php5/lib/libintl.8.dylib

When I “file /usr/local/php5/” …
/usr/local/php5/ Mach-O 64-bit bundle x86_64

When I “file /usr/sbin/httpd” …
/usr/sbin/httpd: Mach-O 64-bit executable x86_64

When I “/usr/local/php5/bin/php -v” …
it shows php 5.5.6

I realize this post is in relation to 5.3 on 10.6 … but it looked like the most relevant place to post this. Any help would be appreciated.

I just tested this on a fresh Mac OS X 10.9.4 installation, and it works fine there.

curl -s | bash -s 5.5
Detected OS X Mavericks 10.9 All ok.

The strange thing is, that it already stops there on your side. And 5.5.6 is also way old, it should install 5.5.16 nowadays. I’m a little at loss here.

And please post issues here: it’s much easier to keep track there than here