If you're interested in helping to ensure that Drupal and its contributed modules are compatible with both MySQL and PostgreSQL (also known as "pgsql"), you should consider setting up local test sites using both database back ends on the same machine. You can even configure both sites to point to the same Drupal installation, using symbolic links.

Unfortunately, the version of PHP that ships with Mac OS by default is not compatible with PostgreSQL, so to do this, you will need to compile both pgsql and php from source. While you're at it, you might want to upgrade to a newer version of MySQL, as well.

  1. Make a directory where you can build all of these programs. For example:
    mkdir /usr/local/src
    cd /usr/local/src
    
  2. Download the latest copies of everything you need:
  3. Unpackage all of these inside /usr/local/src
  4. Configure and build MySQL. Good instructions can be found on this page: MySQL on Mac OS X. The important thing is that when you run configure you use a reasonable value for the --prefix flag. For example: ./configure --prefix=/usr/local/mysql
  5. Configure and build PostgreSQL. Once again, useful installation docs can be found here: PostgreSQL on Mac OS X, though the section about "Postgres and PHP" isn't what you want to read. Again, be sure you use a reasonable value for the--prefix flag. For example: ./configure --prefix=/usr/local/pgsql
  6. Configure and build PHP. After some trial and error, getting PHP working properly with both MySQL and PostgreSQL required a carefully crafted configure line:
    ./configure --with-pgsql=/usr/local/pgsql --with-mysql=/usr/local/mysql --with-apxs --with-kerberos=/usr --with-zlib-dir=/usr --enable-cli --enable-trans-sid --with-xml --enable-exif --enable-ftp --enable-mbstring --enable-mbregex --enable-dbx --enable-sockets --with-iodbc=/usr --with-curl=/usr --with-config-file-path=/etc --sysconfdir=/private/etc --with-mysql-sock=/var/mysql/mysql.sock
    

    Some noteworthy things about this command:

    • This matches the flags used for the default PHP installed on Mac OS X as closely as possible, while also enabling PostgreSQL support.
    • The path you use for --with-pgsql must match whatever you specified for --prefix when building PostgreSQL.
    • The path you use for --with-mysql must match whatever you specified for --prefix when building MySQL.
    • The path you use for --with-mysql-sock should match whatever you specified for --with-unix-socket-path when building MySQL.

Additional information about building PHP on Mac OS X machines can be found on the developer.apple.com site: PHP on Mac OS X

Comments

cloudmaker’s picture

As of Snow Leopard a and later versions of OSX the above is no longer the case. Php is quite up to date.

jhodgdon’s picture

A user reported a problem with installing (and a fix) -- if you are getting errors, see:
#288410: Instructions bad for Mac OS users with older mysql versions.