Req #78096 [NEW]: PHP reads the wrong libpq file
| From: | marcelo at sisflora dot com dot br | Date: | Sun, 02 Jun 2019 03:00:28 +0000 |
| Subject: | Req #78096 [NEW]: PHP reads the wrong libpq file | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-221077@lists.php.net to get a copy of this message | ||
From: marcelo at sisflora dot com dot br
Operating system: Redhat CentOS 7
PHP version: 7.3.6
Package: PostgreSQL related
Bug Type: Feature/Change Request
Bug description:PHP reads the wrong libpq file
Description:
------------
Iâm configuring a virtual machine in Google Cloud Platform, accord
below.
Virtual Machine: machine type: g1-small (1 vCPU, 1.7 GB memory); zone:
us-central1-c; firewalls: Allow HTTP trafficAllow HTTPS traffic.
Operational System: CentOS Linux release 7.6.1810 (Core)
Web server: Apache/2.4.6 (CentOS);
PHP: PHP Version 7.3.6;
Database: PostgreSQL 9.6.13 on x86_64-pc-linux-gnu, compiled by gcc
(GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit.
Install PostgreSQL extensions
[gsuite@flora-vm ~]$ sudo yum install php-pgsql
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.cogentco.com
* epel: mirror.steadfastnet.com
* extras: mirror.cogentco.com
* remi-php70: mirror.team-cymru.com
* remi-php73: mirror.team-cymru.com
* remi-safe: mirror.team-cymru.com
* updates: mirror.cogentco.com
Package php-pgsql-7.3.6-3.el7.remi.x86_64 already installed and latest
version.
Nothing to do
Set up:
vi /etc/php.d/20-pgsql.ini
; Enable pgsql extension module
extension=pgsql
vi /etc/php.d/30-pdo_pqsql.ini
; Enable pdo_pgsql extension module
extension=pdo_pgsql
Script to test php connection with database
<?php
// Configure DB Parameters
$host = "sisflora.com.br";
$dbname = "sisflora";
$dbuser = "postgres";
$userpass = "********";
$con = pg_connect("host=$host dbname=$dbname user=$dbuser
password=$userpass");
if (!$con) {
die('Could not connect');
}
else {
echo ("Connected to local DB");
}
?>
Running this script return
Could not connect
Verifying the return on the phpinfo() function find this:
pdo_pgsql:
PostgreSQL(libpq) version: 9.2.24
pgsql:
PostgreSQL(libpq) version: 9.2.24
PostgreSQL(libpq) version: PostgreSQL 9.2.24 on x86_64-redhat-linux-gnu,
compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28), 64-bit
The sisflora database in PostgreSQL 9.6 it work normally when access
from by the psql or pgAdmin4.
My question is, how to configure PHP 7.3.3 to read PostgreSQL 9.6
correctly, considering that the PHP connection recognized PostgreSQL
9.2?
Test script:
---------------
<?php
// Configure DB Parameters
$host = "sisflora.com.br";
$dbname = "sisflora";
$dbuser = "postgres";
$userpass = "********";
$con = pg_connect("host=$host dbname=$dbname user=$dbuser
password=$userpass");
if (!$con) {
die('Could not connect');
}
else {
echo ("Connected to DB");
}
?>
Expected result:
----------------
Connected to DB
Actual result:
--------------
Could not connect
--
Edit bug report at https://bugs.php.net/bug.php?id=78096&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78096&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78096&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78096&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=78096&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78096&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78096&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78096&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78096&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78096&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78096&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78096&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78096&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78096&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78096&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=78096&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78096&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78096&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78096&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78096&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78096&r=mysqlcfg