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

Andrew McMillan <[email protected]> Fri, 28 May 2010 11:19:15 +1200
Newsgroups gmane.comp.db.postgresql.php
Message-ID <[email protected]>
On Thu, 2010-05-27 at 15:30 -0400, [email protected] 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.
------------------------------------------------------------------------
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEABECAAYFAkv+/e8ACgkQjJA0f48GgBJZRQCeN87ivrPSzCMtX1LMY7WICyVh
p2oAn2DqHv23awEh9U67ZEQkkxCM+LWN
=V2az
-----END PGP SIGNATURE-----