1

I recently upgraded from OS X Yosemite to El Capitan, and I needed to re-install PHP. So, I downloaded php (version 5.6.14), ran the ./configure file, and then ran sudo make. However, when doing so, the compilation fails with the following trailing messages:

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sapi/cli/php] Error 1

I never ran into this message while on Mac OS X 10.9.5 (Yosemite).

How would I resolve this message? I have tried disabling System Integrity Protection (SIP) to no avail.

0

2 Answers 2

2

According to this this GitHub issue report connected to building PHP 5.6.11 beta on Mac OS X 10.11 (El Capitan), the key problem connected to libxml2. Their recommendation in the case of Homebrew is to run this brew link command:

brew link libxml2 --force

But if you are compiling from pure source code, not 100% sure how that would be handled.

That said, I found a similar issue discussed in this Nokogiri Gist—hilariously titled “What to do if libxml2 is being a jerk”—and the clues point to explicitly pointing to the LibXML2 stuff like this:

--with-xml2-include=/usr/local/include/libxml2

But—of course—that would be for Nokogiri’s config options. But looking at the official PHP documentation explains the following:

The optional --with-libxml-dir directive is used to specify the location of libxml on the system that PHP is being compiled on, otherwise only the default locations are scanned.

So knowing that it seems adding --with-libxml-dir to your ./configure command—something with a path set as below—should work:

--with-libxml-dir=/usr/local/include/libxml2

That said, this person’s website has a nice tutorial on how to compile PHP 5.5.24 in Mac OS X that has been updated to cope with Mac OS X 10.10.5 and as well as Mac OS X 10.11. And if you look through the ./configure command you can see that person is using --with-libxml-dir=/usr. While the info is presented as being for PHP 5.5.24, I imagine he process for PHP 5.6.14 should be similar if not the same. Here is their full ./configure command for reference:

./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-config-file-scan-dir=/Library/Server/Web/Config/php' \
  '--with-libxml-dir=/usr' \
  '--with-openssl=/usr' \
  '--with-kerberos=/usr' \
  '--with-zlib=/usr' \
  '--enable-bcmath' \
  '--with-bz2=/usr' \
  '--enable-calendar' \
  '--disable-cgi' \
  '--with-curl=/usr' \
  '--enable-dba' \
  '--with-ndbm=/usr' \
  '--enable-exif' \
  '--enable-fpm' \
  '--enable-ftp' \
  '--with-icu-dir=/usr' \
  '--with-ldap=/usr' \
  '--with-ldap-sasl=/usr' \
  '--with-libedit=/usr' \
  '--enable-mbstring' \
  '--enable-mbregex' \
  '--with-mysql=mysqlnd' \
  '--with-mysqli=mysqlnd' \
  '--without-pear' \
  '--with-pear=no' \
  '--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'
1

Unless you specifically need a newer version, PHP 5.5.27 comes stock with OS X El Capitan.

You can uncomment (remove #) before the line LoadModule php5_module libexec/apache2/libphp5.so inside of httpd.conf (use sudo nano /etc/apache2/httpd.conf to access).

1
  • 1
    Yes, I would like to install a specific version and enable certain plugins (such as curl). So I do need to install from command line. Oct 10, 2015 at 21:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .