i'm getting the following error while trying to run PostgreSQL with PHP & Apache on OS X El Capitan:
Fatal error: Call to undefined function pg_connect()
I have setup Apache & PHP recently and wanted now to add PostgreSQL for database queries. Postgres.app worked well with Java so far. I'm afraid that I miss some very trivial configuration detail.
PHP worked well with php version 5.5.34, so I just wanted to run:
brew install php55-pdo-pgsql
I adjusted the apache-config and recognized brew installed php 5.5.38, as phpinfo(); now shows 38 instead of 34.
Typing php -v in terminal still gives me 5.5.34.
I also tried to do:
brew install php56-pdo-pgsql
But pg_connect() is still undefined. phpinfo(); returns then:
PHP Version 5.6.24 System Darwin XXXYYYZZZ 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
Build Date Jul 22 2016 02:40:35
Configure Command './configure' '--prefix=/usr/local/Cellar/php56/5.6.24' '--localstatedir=/usr/local/var' '--sysconfdir=/usr/local/etc/php/5.6' '--with-config-file-path=/usr/local/etc/php/5.6' '--with-config-file-scan-dir=/usr/local/etc/php/5.6/conf.d' '--mandir=/usr/local/Cellar/php56/5.6.24/share/man' '--enable-bcmath' '--enable-calendar' '--enable-dba' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-mbregex' '--enable-mbstring' '--enable-shmop' '--enable-soap' '--enable-sockets'
'--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--enable-zip' '--with-freetype-dir=/usr/local/opt/freetype' '--with-gd' '--with-gettext=/usr/local/opt/gettext' '--with-iconv-dir=/usr' '--with-icu-dir=/usr/local/opt/icu4c' '--with-jpeg-dir=/usr/local/opt/jpeg' '--with-kerberos=/usr' '--with-libedit' '--with-mhash' '--with-ndbm=/usr' '--with-png-dir=/usr/local/opt/libpng' '--with-xmlrpc' '--with-zlib=/usr' '--with-readline=/usr/local/opt/readline' '--without-gmp' '--without-snmp'
'--with-libxml-dir=/usr/local/opt/libxml2' '--with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc' '--with-unixODBC=/usr/local/opt/unixodbc' '--with-apxs2=/usr/sbin/apxs' '--libexecdir=/usr/local/Cellar/php56/5.6.24/libexec' '--with-bz2=/usr' '--disable-debug' '--with-openssl=/usr/local/opt/openssl' '--enable-fpm' '--with-fpm-user=_www' '--with-fpm-group=_www' '--with-curl' '--with-xsl=/usr' '--with-ldap' '--with-ldap-sasl=/usr' '--with-mysql-sock=/tmp/mysql.sock' '--with-mysqli=mysqlnd' '--with-mysql=mysqlnd'
'--with-pdo-mysql=mysqlnd' '--disable-opcache' '--enable-pcntl' '--without-pear' '--enable-dtrace' '--disable-phpdbg' '--enable-zend-signals' 'CC=clang' 'CXX=clang++'
[...]
pdo_pgsql
PDO Driver for PostgreSQL enabled
PostgreSQL(libpq) Version 9.5.3
Module version 1.0.2
Revision $Id: 0e858dd2051ca8c2fd3c781909a0670ab5fecd36 $