|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55108 Unable to compile with MySQL
Submitted: 2011-07-01 15:04 UTC Modified: 2013-10-01 12:34 UTC
Avg. Score:4.6 ± 0.5
Reproduced:8 of 8 (100.0%)
Same Version:2 (25.0%)
Same OS:4 (50.0%)
From: s21122012 at yahoo dot com Assigned:
Status: Not a bug Package: Compile Failure
PHP Version: 5.4.0alpha1 OS: Mac OS X 10.6.8
Private report: No CVE-ID: None
 [2011-07-01 15:04 UTC] s21122012 at yahoo dot com
I'm trying to compile PHP 5.4 alpha 1 with MySQL support using the configuration 
commands in "Version 1". It produces the error below. If I use "Version 2" (that 
is, no MySQL), it works.

MySQL is 5.5.13 x86_64.

Test script:
Version 1
./configure --prefix=/alt --with-apxs2=/alt/apache/bin/apxs --with-openssl=/alt --with-zlib=/alt --with-curl=/alt --with-gmp=/alt --with-libxml-dir=/alt --enable-ftp --disable-cgi --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config

Version 2
./configure --prefix=/alt --with-apxs2=/alt/apache/bin/apxs --with-openssl=/alt --with-zlib=/alt --with-curl=/alt --with-gmp=/alt --with-libxml-dir=/alt --enable-ftp --disable-cgi

Expected result:
Build complete

Actual result:
Undefined symbols for architecture x86_64:
  "_res_9_init", referenced from:
      _zif_dns_get_mx in dns.o
      _zif_dns_get_record in dns.o
      _zif_dns_check_record in dns.o
  "_res_9_search", referenced from:
      _zif_dns_get_mx in dns.o
      _zif_dns_get_record in dns.o
      _zif_dns_check_record in dns.o
  "_res_9_dn_skipname", referenced from:
      _zif_dns_get_mx in dns.o
      _zif_dns_get_record in dns.o
  "_res_9_dn_expand", referenced from:
      _zif_dns_get_mx in dns.o
      _php_parserr in dns.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [libs/libphp5.bundle] Error 1


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-01 16:22 UTC]
-Status: Open +Status: Feedback
 [2011-07-01 16:22 UTC]
These might be caused by conflicts in the usage of either HAVE_DNS_SEARCH or HAVE_RES_NSEARCH between MySQL libs and PHP. Did you use MySQL binary packages or did you compile MySQL yourself?
I have no Mac at hand, could you please send me the file main/php_config.h from the failing build? - Thanks.

(As remark: You could build PHP using mysqlnd instead of libmysql by using --with-mysql=mysqlnd --with-mysqli=mysqlnd - but your issue should be fixed anyways.)
 [2011-07-01 18:12 UTC] s21122012 at yahoo dot com
-Status: Feedback +Status: Open
 [2011-07-01 18:12 UTC] s21122012 at yahoo dot com
Thank you for your reply!

I used the binary package when I posted the issue, but I had tried with a 
version compiled by myself before and the result was the same. Here is the file 
you requested (it was compiled using only the --prefix, --with-apxs2, --with-
mysql and --with-mysqli flags):

I have been able to compile it with MySQL support using the native driver 
(mysqlnd), as suggested by you.

I would also like to mention that I had similar errors with PHP 5.3.6 in the 
past. I am not sure if the conflict was between the same macros, though.
 [2011-08-29 23:10 UTC] aaronh at bind dot com
Same issue here running Lion Server / 10.7.1 and php-5.3.8 with the mysql 


Darwin 11.0.1 Darwin Kernel Version 11.0.1: Thu Jul 28 
02:01:39 PDT 2011; root:xnu-1699.23.4~1/RELEASE_X86_64 x86_64

Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2335.15~25/src/configure -
-disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --
mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- -
-program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --
build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-
2335.15~25/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-
darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
 [2011-09-01 22:30 UTC] matt dot fellows at onegeek dot com dot au
I had the same issue with php 5.3.8 on Lion, but unfortunately I'm unable to use the mysqlnd option due to the fact that the database I'm connecting to is MySQL v3.

Assuming a default MySQL installation (5.5.15 using either image or source), I was able to solve the issue with the following command:

sudo install_name_tool -id /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.dylib

Hope this helps someone.

 [2011-11-07 20:09 UTC] rpickard at gmail dot com
Hi all,

I had this problem trying to compile php 5.3.8 on OS X 10.7.2 (Lion) with MySQL 
5.5.17 against Apache 2.2.21. I found a solution that would allow the build to 
complete here:

The solution is to set a EXTRA_CFLAGS value of -lresolv. In my case with the bash 

export EXTRA_CFLAGS=-lresolv

and then re-do make. There was no need to do make clean or distclean.

After compiling all tests passed.

Hope this helps,
 [2013-10-01 12:34 UTC]
-Status: Open +Status: Not a bug
 [2013-10-01 12:34 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 15 09:01:28 2024 UTC