Doc #70881 [NEW]: Fatal error: Call to undefined function pg_connect()

From: Date: Mon, 09 Nov 2015 04:53:19 +0000
Subject: Doc #70881 [NEW]: Fatal error: Call to undefined function pg_connect()
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12858@lists.php.net to get a copy of this message
From: gmgoodbody at yahoo dot com Operating system: osx 10.11.1 PHP version: 5.6.15 Package: PDO PgSQL Bug Type: Documentation Problem Bug description:Fatal error: Call to undefined function pg_connect() Description: ------------ --- From manual page: http://www.php.net/faq.databases --- I upgraded to osx El Capitan and now my web development platform is all screwed up; I cannot access my postgres database from the php based webpage I am developing. I have spent over two days searching the internet for a solution but it's full of garbage. Everything I try does not work. I tried rigging the delivered php that comes with the mac, I tried installing php with homebrew using this command: brew install php56-pdo-pgsql Homebrew seemed to install everything but I still get the fatal undefined function pg_connect() error. Test script: --------------- Try to open php in Safari browser: http://localhost/~mymacuser/testpg.php This is what displays on my webpage: Fatal error: Call to undefined function pg_connect() in /Users/mymacuser/Sites/testpg.php on line 8 <?php $host = "localhost"; $port = "5434"; //note: 5434 is the correct port $user = "myuser"; $pass = "mypass"; $db = "mydb"; $con = pg_connect("host=$host port=$port dbname=$db user=$user password=$pass") or die ("Could not connect to server\n"); $query = "SELECT VERSION()"; $rs = pg_query($con, $query) or die("Cannot execute query: $query\n"); $row = pg_fetch_row($rs); echo "Database version... <br>"; echo $row[0] . "\n"; echo "<br><br>"; ?> Expected result: ---------------- The expected result is php would know what pg_connect() means and I wouldn't get a fatal error. Or at least there would be an easy way to know what is wrong with my installation so I can fix it. The PHP installation process is downright horrible. You need to fix/simplify your installation process or people are going to start using a different tool for web development. I've been searching support pages all over the web for two days and there is a lot of garbage out there. It is extremely frustrating. Installing php should NOT be this difficult. Actual result: -------------- My phpinfo() has this: Additional .ini files parsed /usr/local/etc/php/5.6/conf.d/ext-pdo_pgsql.ini pdo_pgsql ... PDO PDO support enabled PDO drivers mysql, odbc, sqlite, pgsql ... PDO Driver for PostgreSQL enabled PostgreSQL(libpq) Version 9.4.5 Module version 1.0.2 Revision $Id: 93432550a76a2298959ec74f40d65c7195a82ad2 $ -- Edit bug report at https://bugs.php.net/bug.php?id=70881&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70881&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70881&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70881&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70881&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70881&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70881&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70881&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70881&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70881&r=support Expected behavior: https://bugs.php.net/fix.php?id=70881&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70881&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70881&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70881&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70881&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70881&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70881&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70881&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70881&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70881&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70881&r=mysqlcfg

« previous php.doc.bugs (#12858) next »