Doc #70881 [Opn->Nab]: Fatal error: Call to undefined function pg_connect()

From: Date: Mon, 09 Nov 2015 05:00:12 +0000
Subject: Doc #70881 [Opn->Nab]: Fatal error: Call to undefined function pg_connect()
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12859@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70881&edit=1 ID: 70881 Updated by: requinix@php.net Reported by: gmgoodbody at yahoo dot com Summary: Fatal error: Call to undefined function pg_connect() -Status: Open +Status: Not a bug Type: Documentation Problem Package: PDO PgSQL Operating System: osx 10.11.1 PHP Version: 5.6.15 Block user comment: N Private report: N New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. You have the pdo_pgsql extension installed but are trying to use functions from pgsql extension. They are two different things. http://php.net/pdo Previous Comments: ------------------------------------------------------------------------ [2015-11-09 04:53:17] gmgoodbody at yahoo dot com 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 this bug report at https://bugs.php.net/bug.php?id=70881&edit=1

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