pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Fatal error: Call to undefined function pg_connect()
5+ messages / 5 participants
[nested] [flat]

* Fatal error: Call to undefined function pg_connect()
@ 2010-05-27 19:30  Steve.Toutant@inspq.qc.ca
  0 siblings, 2 replies; 5+ messages in thread

From: Steve.Toutant@inspq.qc.ca @ 2010-05-27 19:30 UTC (permalink / raw)
  To: 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

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Fatal error: Call to undefined function pg_connect()
@ 2010-05-27 22:50  Chris <dmagick@gmail.com>
  parent: Steve.Toutant@inspq.qc.ca
  1 sibling, 0 replies; 5+ messages in thread

From: Chris @ 2010-05-27 22:50 UTC (permalink / raw)
  To: pgsql-php

On 28/05/10 05:30, Steve.Toutant@inspq.qc.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/




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Fatal error: Call to undefined function pg_connect()
@ 2010-05-27 23:19  Andrew McMillan <andrew@morphoss.com>
  parent: Steve.Toutant@inspq.qc.ca
  1 sibling, 0 replies; 5+ messages in thread

From: Andrew McMillan @ 2010-05-27 23:19 UTC (permalink / raw)
  To: Steve.Toutant@inspq.qc.ca; +Cc: pgsql-php

On Thu, 2010-05-27 at 15:30 -0400, Steve.Toutant@inspq.qc.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.
------------------------------------------------------------------------

Attachments:

  signature.asc (application/pgp-signature, 197B) download

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Fatal error: Call to undefined function pg_Connect()
@ 2017-01-03 10:46  Olorin <can@yabil.net>
  0 siblings, 1 reply; 5+ messages in thread

From: Olorin @ 2017-01-03 10:46 UTC (permalink / raw)
  To: pgsql-php

i ve Ubuntu 16.04 with php7, apache2, PostgreSQL v9.5 VPS at digitalocean and
im tryig to read data form Odoo 8 PostgreSQL. im lack of knowledge and
trying to learn.

here is the code which is in my 2nd hosting server php
http://pastebin.com/R3bwfXtR

but im getting Call to undefined function pgConnect() in
/home/f****/publichtml/***.****.net/new.php on line 11

php -i result:
http://pastebin.com/5z6G73Tw

i tried like every possible solutions but no luck. DigitalOcean support team
couldnt solve it in 4 days and now im open to all solutions.
i can give u server access if you are reliable.

Sorry for my bad english.
Please help



--
View this message in context: http://postgresql.nabble.com/Fatal-error-Call-to-undefined-function-pg-Connect-tp5937112.html
Sent from the PostgreSQL - php mailing list archive at Nabble.com.


-- 
Sent via pgsql-php mailing list (pgsql-php@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-php



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Fatal error: Call to undefined function pg_Connect()
@ 2017-01-06 19:07  Greg Sabino Mullane <greg@turnstep.com>
  parent: Olorin <can@yabil.net>
  0 siblings, 0 replies; 5+ messages in thread

From: Greg Sabino Mullane @ 2017-01-06 19:07 UTC (permalink / raw)
  To: pgsql-php; +Cc: can@yabil.net


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> but im getting Call to undefined function pgConnect() in
> /home/f****/publichtml/***.****.net/new.php on line 11

Was it really "pgConnect()" not pg_Connect()? Precision is 
important when reporting error messages. We'll assume that 
pg_connect() was the function not found.

It looks like you have PDO support compiled in, so the best 
solution is to simply use that instead of the older pg_* functions.

See for example:

https://phpdelusions.net/pdo

(There are many other tutorials. With all, replace mysql with pgsql)

- -- 
Greg Sabino Mullane greg@turnstep.com
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201701061401
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAlhv6r8ACgkQvJuQZxSWSshx9wCgihVLLKwdXTXx6g4xXuGyUokM
2JIAnjmhJ0Kzg1Y1ZjDF+wv1Y5wHIOBn
=qoPH
-----END PGP SIGNATURE-----




-- 
Sent via pgsql-php mailing list (pgsql-php@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-php



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2017-01-06 19:07 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-05-27 19:30 Fatal error: Call to undefined function pg_connect() Steve.Toutant@inspq.qc.ca
2010-05-27 22:50 ` Chris <dmagick@gmail.com>
2010-05-27 23:19 ` Andrew McMillan <andrew@morphoss.com>
2017-01-03 10:46 Fatal error: Call to undefined function pg_Connect() Olorin <can@yabil.net>
2017-01-06 19:07 ` Re: Fatal error: Call to undefined function pg_Connect() Greg Sabino Mullane <greg@turnstep.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox