When installing PHP on a new blank installation of Mountain Lion I kept running into problems getting PHP working with GD. There was stuff missing in the installed that was not covered in the additional X11redirect package. But after a lot of late nights with Google I finally figured it out. The X11 server is no longer included in Mountain Lion and you need to install it separately. Once I figured this out I also found the Apple support item on this. As you see it’s all about using the right keywords when trying to find something, who thought that the X11 server has the required components for the GD parts of PHP.

So what I need to add to the instructions is that you need to download and install the XQuartz X11 server to be able to include GD with PHP. Just install the package and all will be fine again.