PHP Installation On Mac

Instead of relying on MAMP, XAMP etc., you can configure your Mac to use the latest version of PHP.

MAMP and XAMP doesn’t come with the latest version of php and hence this exercise.

The steps involved are that we need to install:

1. Install Xcode
2. Install XCode Command line tools
3. Install XQuartz
4. Install Homebrew
5. brew install libjpeg
6. brew install pcre
7. brew install libxml2
8. brew install mcrypt
9. brew install libpng

mcrypt is needed for Laravel Framework

To support internationalization, download ICU from ICU-Project.org

tar xzvf icu4c-4_8_1-src.tgz
cd icu/source
./runConfigureICU MacOSX
make
sudo make install

Run the following:
./configure \
–prefix=/usr \
–mandir=/usr/share/man \
–infodir=/usr/share/info \
–sysconfdir=/private/etc \
–with-apxs2=/usr/sbin/apxs \
–enable-cli \
–with-config-file-path=/etc \
–with-libxml-dir=/usr \
–with-openssl=/usr \
–with-kerberos=/usr \
–with-zlib=/usr \
–enable-bcmath \
–with-bz2=/usr \
–enable-calendar \
–with-curl=/usr \
–enable-dba \
–enable-exif \
–enable-ftp \
–with-gd \
–enable-gd-native-ttf \
–with-icu-dir=/usr/local \
–with-iodbc=/usr \
–with-ldap=/usr \
–with-ldap-sasl=/usr \
–with-libedit=/usr \
–enable-mbstring \
–enable-mbregex \
–with-mysql=mysqlnd \
–with-mysqli=mysqlnd \
–without-pear \
–with-pdo-mysql=mysqlnd \
–with-mysql-sock=/var/mysql/mysql.sock \
–with-readline=/usr \
–enable-shmop \
–with-snmp=/usr \
–enable-soap \
–enable-sockets \
–enable-sysvmsg \
–enable-sysvsem \
–enable-sysvshm \
–with-tidy \
–enable-wddx \
–with-xmlrpc \
–with-iconv-dir=/usr \
–with-xsl=/usr \
–enable-zip \
–with-imap=/usr/local/imap-2007 \
–with-kerberos \
–with-imap-ssl \
–enable-intl \
–with-pcre-regex \
–with-pgsql=/usr \
–with-pdo-pgsql=/usr \
–with-freetype-dir=/usr/X11 \
–with-jpeg-dir=/usr \
–with-png-dir=/usr/X11 \
–with-mcrypt=/usr

I got two errors:

1. configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

To resolve the error you need to compile IMAP.

So I did the following steps:

1. Downloaded the latest version of IMAP from http://www.washington.edu/imap/
2. make osx EXTRACFLAGS=”-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp”
3. sudo mkdir /usr/local/include/
4. sudo cp c-client/*.h /usr/local/include/
5. sudo mkdir /usr/local/lib/
6. sudo cp c-client/*.c /usr/local/lib
7. sudo cp c-client/c-client.a /usr/local/lib/libc-client.a

2. After that I got another error

configure: error: Unable to detect ICU prefix or /usr/bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works.

The error was due to the value of “–with-icu-dir=/usr/” The ICU got installed in /usr/local Directory. So after changing the value to “–with-icu-dir=/usr/local”

The configure command was successful.

Then I ran make and make install for the successful php install/upgrade.

About these ads

About Rajan

Am working in latest Oracle technologies.Have worked a lot in 11i, R12, Learning Siebel, FMW and other technologies.Have worked actively in many critical business transformation projects.

5 Responses to “PHP Installation On Mac”

  1. Hello there, I had exactly the both errors you have had, but since I am using homebrew to solve the first one I just run `brew install imap-uw`. To solve the second one I made as you said. And by the way, thanx!

  2. Thank you man! Just had the exact 2 problems and your solution worked.

  3. Thank you man! Just had the exact problems and now everything works. Great!

  4. /usr/local/src/php-5.5.10/ext/gd/gd.c:80:12: fatal error: ‘ft2build.h’ file not found
    # include
    ^
    1 error generated.
    make: *** [ext/gd/gd.lo] Error 1

Trackbacks/Pingbacks

  1. Upgrading Native PHP on MacOSX Mountain Lion | IT Journal - February 9, 2013

    […] PHP 5.4 on Mac OS X Mountain Lion from Source Snow Leopard PHP and IMAP Support PHP Installation On Mac Installation failed with icu-config error on Mac OS X 10.8 Upgrading the Native PHP Installation on […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: