Re: Fatal error: Call to undefined function pg_connect()

Lists: pgsql-php
From: Steve(dot)Toutant(at)inspq(dot)qc(dot)ca
To: pgsql-php(at)postgresql(dot)org
Subject: Fatal error: Call to undefined function pg_connect()
Date: 2010-05-27 19:30:35
Message-ID: OFD667D637.1D62587D-ON85257730.006AE38B-85257730.006B2BA8@isn.rtss.qc.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

Hi,
I created a php page and the code connects to my postgres database and do
stuff...
that works well when launched from a browser

But it doesn't from a command line
PHP myFile.php

I get this error
Fatal error: Call to undefined function pg_connect()

It seems that php.exe does not recognize postgres functions.

In \ms4w\Apache\cgi-bin\php.ini I have this:
extension=php_pgsql.dll and this dll is in \ms4w\Apache\php\ext

PATH variable contains this
C:\Program Files\PostgreSQL\8.3\bin;

phpinfo() launched via a browser give me this

This command php -i from a command prompt doesn't return any pgsql
extension
What should I do to be able to call the postgres functions when using
php.exe from a command line?
thanks
steve


From: Chris <dmagick(at)gmail(dot)com>
To: pgsql-php(at)postgresql(dot)org
Subject: Re: Fatal error: Call to undefined function pg_connect()
Date: 2010-05-27 22:50:55
Message-ID: 4BFEF74F.6080101@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-php

On 28/05/10 05:30, Steve(dot)Toutant(at)inspq(dot)qc(dot)ca wrote:
>
> Hi,
> I created a php page and the code connects to my postgres database and
> do stuff...
> that works well when launched from a browser
>
> But it doesn't from a command line
> PHP myFile.php
>
> I get this error
> Fatal error: Call to undefined function pg_connect()
>
> It seems that php.exe does not recognize postgres functions.
>
> In \ms4w\Apache\cgi-bin\php.ini I have this:
> extension=php_pgsql.dll and this dll is in \ms4w\Apache\php\ext

Any errors in apache or system logs ?

Could there be something this dll is missing? I don't know much about
windows unfortunately but this may help figure out what else you need to
include:

http://www.dependencywalker.com/

--
Postgresql & php tutorials
http://www.designmagick.com/


From: Andrew McMillan <andrew(at)morphoss(dot)com>
To: Steve(dot)Toutant(at)inspq(dot)qc(dot)ca
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: Fatal error: Call to undefined function pg_connect()
Date: 2010-05-27 23:19:15
Message-ID: 1275002355.3344.2204.camel@happy.home.mcmillan.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토 사이트SQL : Postg토토 사이트SQL 메일 링리스트 : 2010-05-27 이후 PGSQL-PHP 23:19

On Thu, 2010-05-27 at 15:30 -0400, Steve(dot)Toutant(at)inspq(dot)qc(dot)ca wrote:
>
> Hi,
> I created a php page and the code connects to my postgres database and
> do stuff...
> that works well when launched from a browser
>
> But it doesn't from a command line
> PHP myFile.php
>
> I get this error
> Fatal error: Call to undefined function pg_connect()
>
> It seems that php.exe does not recognize postgres functions.
>
> In \ms4w\Apache\cgi-bin\php.ini I have this:
> extension=php_pgsql.dll and this dll is in \ms4w\Apache\php\ext

When you run PHP from the command line you will be using a different
php.ini, and it's that one that you need to find and add the above line
to.
>
> PATH variable contains this
> C:\Program Files\PostgreSQL\8.3\bin;
>
>
>
> phpinfo() launched via a browser give me this

Try launching phpinfo() from a command line.

PHP -r 'phpinfo();'

Not that I've used it on Windows, but that's certainly how it works on
Linux.

Cheers,
Andrew.

--
------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com +64(272)DEBIAN
Chicken Little only has to be right once.
------------------------------------------------------------------------