1

I have problem with Postgres.app. Postgres.app is running without problems.

In my phpinfo() I can see.

PDO drivers => mysql, odbc, sqlite, pgsql

If I run commat php -m I can see:

...
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite

Everything seems to be installed and prepared. But If I run my project, It says.

could not find driver

I've installed pgsql and pdo_pgsql by following link https://alistairphillips.com/apple/osx/php-pdo-pgsql/

PS: I also have

extension=pdo_pgsql.so
extension=pgsql.so
Filip Lukáč
  • 100
  • 1
  • 2
  • 13

1 Answers1

3

After install new OS X El Capitan I have to: Please note that I've installed http://postgresapp.com/ I highly recommend this.

  • Install PHP5 from http://php-osx.liip.ch/
  • Download PHP source packages (for my version) from http://php.net/downloads.php
  • Unpack sources and do following:
    • cd php-{version}/ext/pdo_pgsql
    • phpize
    • ./configure --with-pdo-pgsql="/Applications/Postgres.app/Contents/Versions/9.4"
    • sudo make && make install
  • Install pgsql:
    • cd php-{version}/ext/pgsql
    • phpize
    • ./configure --with-pgsql="/Applications/Postgres.app/Contents/Versions/9.4"
    • sudo make && make install

Or I've modified one script I've found. You can download and use it from https://gist.github.com/FilipLukac/b460b233857a65e1342a

  • Set up PHP_VERSION variable
  • Set up PHP_INI variable (php.ini file location path)
  • Run ./install.sh

And then restart apache sudo apachectl -k restart

Filip Lukáč
  • 100
  • 1
  • 2
  • 13
  • On sudo make && make install, I get the error: `fatal error: 'pdo/php_pdo_error.h' file not found #include "pdo/php_pdo_error.h"`. I downloaded php 5.6.1 – Chandrew Oct 19 '15 at 22:23
  • 1
    Fixed the previous error by changing the `pgsqldriver.c`'s `#include "pdo/php_pdo_error.h"` to `#include "../pdo/php_pdo_error.h"`. The next error is the "rootless" feature of El Capitan: `Operation not permitted make: *** [install-modules] Error 1` – Chandrew Oct 20 '15 at 15:10