Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do I figure out which ./configure options to use when building PHP 5.3.0 on Mac OS X? There are 10 zillion options and I have no idea which ones to use.

All I want is to make sure that I have PDO and PDO+MySQL enabled.


[[[[scream!]]]] I ran sudo port install php5-mysql and it "worked", but when I run php:

$ php
PHP Warning:  Cannot load module 'mysql' because required module 'mysqlnd' is not loaded in Unknown on line 0

Warning: Cannot load module 'mysql' because required module 'mysqlnd' is not loaded in Unknown on line 0
dyld: lazy symbol binding failed: Symbol not found: __mysqlnd_palloc_rinit
  Referenced from: /opt/local/lib/php/extensions/no-debug-non-zts-20090626/mysqli.so
  Expected in: dynamic lookup

dyld: Symbol not found: __mysqlnd_palloc_rinit
  Referenced from: /opt/local/lib/php/extensions/no-debug-non-zts-20090626/mysqli.so
  Expected in: dynamic lookup

Trace/BPT trap


aha! The maintainer of macports found the same problem. I did sudo port selfupdate and reran the install of php5 and it worked fine.

share|improve this question
    
You might consider accepting an answer (it'll help your acceptance rate and give points to whomever you choose). –  Nerdling Sep 13 '09 at 2:16
    
thanks but not till I actually get something working. –  Jason S Oct 17 '09 at 14:26
add comment

4 Answers 4

up vote 3 down vote accepted

Use MacPorts as they have packaged together most of the settings in a way much easier to understand. For example:

port install php5-mysql

share|improve this answer
    
aha, that's the kind of approach I think I'd like. Do they document which configure options they use and why? –  Jason S Aug 26 '09 at 13:12
    
You can view the configuration flags as they're run port -d ... or [view the portfiles][1]. [1] trac.macports.org/browser/trunk/dports/php/php5-mysql/Portfile –  Nerdling Aug 26 '09 at 13:41
add comment

Enable the options you want by specifying them on the configure command line. The MySQL options that appear in my 5.1.6 configure command are as follows:

$ ./configure --help | grep mysql
  --with-mysql[=DIR]      Include MySQL support. DIR is the MySQL base directory
  --with-mysql-sock[=DIR]   MySQL: Location of the MySQL unix socket pointer.
  --with-mysqli[=FILE]    Include MySQLi support. FILE is the optional pathname 
                          to mysql_config
  --enable-embedded-mysqli  MYSQLi: Enable embedded support
  --with-pdo-mysql[=DIR]    PDO: MySQL support. DIR is the MySQL base directory

At a minimum, I would specify an install prefix along with the type (v1 or v2) of Apache install (which you should have already built) you have:

$ ./configure --prefix=/opt/apache --with-apxs2=/opt/apache/bin/apxs \
--with-mysql --with-pdo-mysql

Ensure that mysql_config (assuming there is such a thing) is in your path, or tell configure where the mysql libraries are located.

share|improve this answer
add comment

How do I figure out which ./configure options to use when building PHP 5.3.0 on OSX?

If you want some really generic advice for building packages when you need to know how to configure something.

  • Read the Fine Manual, usually the docs will give examples telling you what you need, and what option does what. Read the file named INSTALL, check the web site. For a package as popular as PHP the information should be pretty easy to find.
  • PHP 5.3.0 is a pretty new package, but there are older packages available. Go find a package someone else built and copy the configuration line they used.
share|improve this answer
add comment

For PHP 5.3, integrating MySQL access libraries is really easy. It's just a matter of enabling the MySQL Native Driver (or mysqlnd) in the configure flags:

./configure --enable-pdo --with-mysql=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd

For what it's worth, take a look at buildphp, which is a Rake-based build system for PHP that was made specifically to make compiling PHP 5.3 (and an up-to-date set of libraries for PHP extensions) easy.

http://github.com/patcoll/buildphp

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.