You are right, Yosemite inline PHP comes without PNG and FreeType support.
2015/10 Update for El Captian:. With OS X 10.11, support for ElGlanguage PNG has returned, but FreeType is still missing.
Decision
Use the Homebrew package manager to seamlessly create and install full PHP and replace it in your Apache configuration. The whole process takes about ten minutes if you follow these steps.
A quick (but complete) walk around
(Note 1: here I use Homebrew, the package management system for OS X. If you are familiar with MacPorts - another package manager - you can get the same results with this system. It is also possible to use my Homebrew solution in parallel with the existing MacPorts installation on your computer .)
(Note 2: If you want to read all the details of the installation process, see the basic Homebrew installation and information on the PHP home installation , but you won’t need it if you follow these steps.)
Now let go ...
First install Xcode from the App Store . If you already have one, check the App Store again to make sure you have the latest version!
Now you need to install the Xcode command line tools. To do this, open a terminal and enter:
xcode-select
The following command will install the Homebrew package manager system:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
The script explains what it will do, and then pauses before it does.
The following command to enter is a kind of system state test:
brew doctor
This tests the basics of installing Homebrew.
I got a warning "You have MacPorts or Fink installed: / opt / local / bin / port ...", which I ignored successfully .;)
Now configure the homebrew / dupes keyword, which has the necessary dependencies:
brew tap homebrew/dupes
Install a homebrew / version tap that also has the necessary dependencies:
brew tap homebrew/versions
Then run the following command:
brew tap homebrew/homebrew-php
Now you are ready to finally build PHP. For a list of available configuration options, you can do one of the following:
brew options php55 brew options php56
But I was fine using the default settings.
To do this, enter ONE of these two, depending on your needs:
brew install php55 brew install php56
(It will take some time, please be patient!)
there is an error installing php56 (5.6.x) on Yosemite (10.10.5), see this issue on github, use brew install php56 --without-ldap instead.
If you get the error “Cannot find OpenSSL”, you did not install the Xcode command line tools, as I told you at the beginning .;) Go ahead, install them and run the last command.
PHP is now built, and the script will contain some information on how to use it:
Open httpd.conf (should be located in / private / etc / apache 2 / httpd.conf) and enable PHP by adding ONE of these two lines, depending on which version of PHP you just installed:
LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
Do not forget to comment on any existing line LoadModule php5_module ..., which may be present in the native version of PHP Yosemite!
Restart apache
sudo apachectl restart
Your new php.ini file can be found at: /usr/local/etc/php/5.5/php.ini
Enjoy it!