Bug #72544 [NEW]: pg_connect using the "service" parameter
From: floriparob at gmail dot com
Operating system: Debian
PHP version: 5.6.23
Package: PostgreSQL related
Bug Type: Bug
Bug description:pg_connect using the "service" parameter
Description:
------------
The documentation for pg_connect says that it recognises the "service"
parameter as a connect string.
In the pg_service.conf file you can have entries for several databases,
each with their own distinct IP addresses, passwords, etc. So, in your
PHP code you'd expect to be able to do something like this wrapped up in
a try catch block:-
$connect_string = "service=staging";
$pg_handle = pg_connect($connect_string);
to access the "staging" data base.
With psql you have to do this:-
PGSERVICE=staging;export PGSERVICE
psql
is run without any parameters. It opens the pg_service.conf file and
finds the entry defined as "staging" and from that obtains all the
necessary configuration parameters in order to open a connection to that
database.
I tried this:-
putenv("PGSERVICE=staging");
$connect_string = "service=staging";
$pg_handle = pg_connect($connect_string);
but still no luck.
So, if this is not a bug could somebody please enlighten me about the
correct way to connect using pg_service.conf.
--
Edit bug report at https://bugs.php.net/bug.php?id=72544&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72544&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72544&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72544&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72544&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72544&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72544&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72544&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72544&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72544&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72544&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72544&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72544&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72544&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72544&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72544&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72544&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72544&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72544&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72544&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72544&r=mysqlcfg
Thread (6 messages)
- floriparob at gmail dot com