2

As the title mentions, I am trying to add the pgsql extension to php, to be able to call functions like: pg_connect() pg_query() etc. in php. I am using Mac OSX 10.10.1 (Yosemite)

Those are the steps I followed (precisely- and encountered no errors)

  1. Found my version of PHP: php -v.
  2. Downloaded the version of PHP that matches mine: curl -O http://us.php.net/distributions/php-5.5.14.tar.gz.
  3. Extracted the archive I downloaded: tar -xzvf php-5.5.14.tar.gz
  4. Changed to the PostgreSQL's extension directory: cd php5.5.14/ext/pgsql/
  5. Typed phpize (already have autoconf installed)
  6. Typed ./configure --with-pgsql=/Library/PostgreSQL/9.4
  7. Typed make.
  8. Typed sudo make install.
  9. Added the extension to my php.ini file by adding extension=pgsql.so.
  10. Restarted Apache

If I now execute pg functions in php it still comes up with the same error as before: "Fatal error: Call to undefined function pg_connect() in /Applications/XAMPP/xamppfiles/htdocs/connect.php on line 8"

In the terminal php -m, will NOT list pgsql. Maybe someone's got some ideas, what could be going wrong in the install process.

noia
  • 31
  • 3
  • I have no experience with pgsql, but it looks like this might be a bug. Consider contacting the developer team. – slartidan Jul 07 '15 at 12:36
  • Thanks for your advice, I guess that's what I will do. – noia Jul 07 '15 at 13:09
  • Try: `php-config --extension-dir`. That indicates where the extensions should be placed. Compare that to where `sudo make install` installed it. If that's not the same place, then it's normal that php ignores your self-compiled extension. – Daniel Vérité Jul 07 '15 at 15:15
  • 1
    try brew reinstall php55 --with-postgresql [other options] – Jason G Oct 05 '15 at 20:24

0 Answers0