Can't compile PHP 5.6.1 from source I'm trying to compile PHP 5.6.1 on my MacBook Pro but I can't seem to get pass all the problems.

I get stuck with the error message at make:

clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:138: recipe for target 'libs/libphp5.bundle' failed
make: *** [libs/libphp5.bundle] Error 1


I compiled the Apache v. 2.4.10 from source with configure options: 

sudo ./configure --prefi=/usr/local/apache2 --enable-so --enable-modules=most


Apache is working normally.

My configure options for PHP:

sudo ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --disable-ipv6 --enable-dtrace --with-zlib --with-curl=/usr/local/cURL --enable-ftp --enable-mbstring --with-mcrypt=/usr/local/libmcrypt --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-opcache=no


I can't get pass the make process. I've tried everything: sudo make clean doesn't help. I've reinstalled Xcode and CommandLineTools. And tried everything that I could find searching the web but to no prevail.

Does anyone know why it doesn't work?

My last resort would be reinstall mavericks (if anything was overwritten or broken) but that is the last resort I want to take and start over again on a fresh copy.

Thanks for all your help. 

Pending my research: PHP only throws the error when trying to configure it with mysqli.

Undefined symbols for architecture x86_64:
  "_dns_free", referenced from:
      _zif_dns_check_record in dns.o
      _zif_dns_get_record in dns.o
      _zif_dns_get_mx in dns.o
  "_dns_open", referenced from:
      _zif_dns_check_record in dns.o
      _zif_dns_get_record in dns.o
      _zif_dns_get_mx in dns.o
  "_dns_search", referenced from:
      _zif_dns_check_record in dns.o
      _zif_dns_get_record in dns.o
      _zif_dns_get_mx in dns.o
  "_res_9_dn_expand", referenced from:
      _php_parserr in dns.o
      _zif_dns_get_mx in dns.o
  "_res_9_dn_skipname", referenced from:
      _zif_dns_get_record in dns.o
      _zif_dns_get_mx in dns.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libs/libphp5.bundle] Error 1


What am I missing?
Managed to find the problem.

Remove the previous installation and then:

--with-mysqli : I used the native MySql driver ( omitted the folder path )

So when you forget to add a module to your initial compilation and you are stuck with some kind a freaky error delete the old instance that successfully installed and do the ./configure ; make clean ; make ; make install just to be sure:)

Thanks goes to David Parker for helping me with the problem.

Thanks David.