Skip navigation

Trying to get PostgreSQL going on SL Server

281 Views 1 Reply Latest reply: Aug 23, 2011 6:12 PM by etresoft RSS
Transini Level 1 Level 1 (135 points)
Currently Being Moderated
Aug 23, 2011 4:51 PM

On a 10.6.8 OSX Server system I'm trying to install PostgreSQL to test things out before we upgrade to Lion, but I can't get PHP5 to include PostgreSQL support. Here's what I've tried:


- sudo port postgresql90

- sudo port postgresql90-server

- sudo port php5 +postgresql

- inserting the line "" into /etc/php.ini

- rebooting


Interactively, a new PHP is there and psql is there, but when I attempt to connect to a PostgreSQL database from a PHP script in a web browser I get:


PHP Fatal error:  Call to undefined function pg_connect()


Doing a phpinfo() interactively in the Terminal shows the new version of PHP is there and has psql support built in. But doing this in the browser shows PHP is still at 5.3.4 and there's no reference to PostgreSQL. Doing a extension_loaded('pgsql') returns a null. Is Apache somehow built against a version of PHP without PostgreSQL?


How can I get this going?

  • etresoft Level 7 Level 7 (23,880 points)
    Currently Being Moderated
    Aug 23, 2011 6:12 PM (in response to Transini)

    Those port packages are 3rd party tools. They do not affect the system-installed versions of PHP. You would have to either replace Apache's PHP module or replace the system Apache with a "port" version.


    Instead of replacing PHP, I suggest following this tutorial to add the PostgreSQL extension to the system PHP.


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.