title: Couldn't install php55 by brew, tried all the possible solutions
body: <p>I had pre-installed php 5.4.24 when I bought my mac. Then with Brew I installed php 5.5.8 which was working fine. Yesterday, I wanted to install php 5.2 which I started via brew install php52. It gave issue-</p>
  
  <p>1) Configure error: freetype.h not found
  After I fixed that I had another issue-</p>
  
  <p>2) configure: error: GD build test failed. Please check the config.log for details.</p>
  
  <p>Then I realised I was not able to run php 5.5.8 that I had installed before. I uninstalled it and then while re-installing: brew install php55, I had the issue:
  configure: error: GD build test failed. Please check the config.log for details.</p>
  
  <p>I tried all the possible things:</p>
  
  <p>1) Ran brew docor.</p>
  
  <p>2) brew upgrade &amp;&amp; brew update.</p>
  
  <p>3) rm freetype zlib gd .....</p>
  
  <p>4) brew install freetype zlib gd</p>
  
  <p>5) Linking all of them properly.</p>
  
  <p>I am not able to proceed. Please Help.
  Please dont ask me to do via macports or MAMP.</p>
  
  <p>config.log-></p>
  
  <pre><code>`$ ./configure --prefix=/usr/local/Cellar/php55/5.5.11 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.5 --with-config-file-path=/usr/local/etc/php/5.5 --with-config-file-scan-dir=/usr/local/etc/php/5.5/conf.d --with-iconv-dir=/usr --enable-dba --with-ndbm=/usr --enable-exif --enable-soap --enable-wddx --enable-ftp --enable-sockets --enable-zip --enable-shmop --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-mbstring --enable-mbregex --enable-bcmath --enable-calendar --with-zlib=/usr/local/opt/zlib --with-ldap --with-ldap-sasl=/usr --with-xmlrpc --with-kerberos=/usr --with-gd --enable-gd-native-ttf --with-freetype-dir=/usr/local/opt/freetype --with-jpeg-dir=/usr/local/opt/jpeg --with-png-dir=/usr/local/opt/libpng --with-gettext=/usr/local/opt/gettext --with-snmp=/usr --with-libedit --with-unixODBC=/usr/local/opt/unixodbc --with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc --mandir=/usr/local/Cellar/php55/5.5.11/share/man --with-mhash --with-curl --with-bz2=/usr --disable-debug --with-openssl=/usr --with-xsl=/usr --with-apxs2=/usr/sbin/apxs --libexecdir=/usr/local/Cellar/php55/5.5.11/libexec --with-mysql-sock=/tmp/mysql.sock --with-mysqli=mysqlnd --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --enable-pcntl --enable-zend-signals --enable-dtrace --enable-opcache
  
  ## --------- ##
  ## Platform. ##
  ## --------- ##
  
  hostname = Subham-Khandelwal.local
  uname -m = x86_64
  uname -r = 13.1.0
  uname -s = Darwin
  uname -v = Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64
  
  /usr/bin/uname -p = i386
  /bin/uname -X     = unknown
  
  /bin/arch              = unknown
  /usr/bin/arch -k       = unknown
  /usr/convex/getsysinfo = unknown
  /usr/bin/hostinfo      = Mach kernel version:
           Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64
  Kernel configured for up to 4 processors.
  2 processors are physically available.
  4 processors are logically available.
  Processor type: i486 (Intel 80486)
  Processors active: 0 1 2 3
  Primary memory available: 8.00 gigabytes
  Default processor set: 218 tasks, 1116 threads, 4 processors
  Load average: 4.00, Mach factor: 0.93
  /bin/machine           = unknown
  /usr/bin/oslevel       = unknown
  /bin/universe          = unknown
  
  PATH: /usr/local/Library/ENV/4.3
  PATH: /usr/local/opt/libpng/bin
  PATH: /usr/local/opt/freetype/bin
  PATH: /usr/local/opt/gettext/bin
  PATH: /usr/local/opt/jpeg/bin
  PATH: /usr/local/opt/unixodbc/bin
  PATH: /usr/bin
  PATH: /bin
  PATH: /usr/sbin
  PATH: /sbin
  
  ## ----------- ##
  ## Core tests. ##
  ## ----------- ##
  ::
  ::
  configure:4184: result: yes
  configure:4193: checking whether clang accepts -g
  configure:4213: clang -c -g  conftest.c &gt;&amp;5
  configure:4213: $? = 0
  configure:4254: result: yes
  configure:4271: checking for clang option to accept ISO C89
  configure:4334: clang  -c -g -O2  conftest.c &gt;&amp;5
  configure:4334: $? = 0
  configure:4347: result: none needed
  configure:4373: checking how to run the C preprocessor
  configure:4404: clang -E  conftest.c
  configure:4404: $? = 0
  configure:4418: clang -E  conftest.c
  conftest.c:9:10: fatal error: 'ac_nonexistent.h' file not found
  #include &lt;ac_nonexistent.h&gt;
  
  
  1 error generated.
  configure:4418: $? = 1
  configure: failed program was:
  | /* confdefs.h */
  | #define PACKAGE_NAME ""
  | #define PACKAGE_TARNAME ""
  | #define PACKAGE_VERSION ""
  | #define PACKAGE_STRING ""
  | #define PACKAGE_BUGREPORT ""
  | #define PACKAGE_URL ""
  | /* end confdefs.h.  */
  | #include &lt;ac_nonexistent.h&gt;
  configure:4443: result: clang -E
  configure:4463: clang -E  conftest.c
  configure:4463: $? = 0
  configure:4477: clang -E  conftest.c
  conftest.c:9:10: fatal error: 'ac_nonexistent.h' file not found
  #include &lt;ac_nonexistent.h&gt;
           ^
  1 error generated.
  configure:4477: $? = 1
  configure: failed program was:
  | /* confdefs.h */
  
  | #define PACKAGE_NAME ""
  
  | #define PACKAGE_TARNAME ""
  
  | #define PACKAGE_VERSION ""
  
  | #define PACKAGE_STRING ""
  
  | #define PACKAGE_BUGREPORT ""
  
  | #define PACKAGE_URL ""
  
  | /* end confdefs.h.  */
  
  | #include &lt;ac_nonexistent.h&gt;
  
  configure:4508: checking for icc
  
  configure:4517: result: no
  ::
  ::
  conftest.c:52:10: fatal error: 'minix/config.h' file not found
  #include &lt;minix/config.h&gt;
  
  conftest.c:58:10: fatal error: 'sys/pstat.h' file not found
  #include &lt;sys/pstat.h&gt;
  
  ::
  configure:10853: clang -o conftest -g -O2 -fvisibility=hidden  -no-cpp-precomp  conftest.c  &gt;&amp;5
  
  conftest.c:26:10: fatal error: 'sys/exec.h' file not found
  
  include &lt;sys/exec.h&gt;`
  </code></pre>