php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #79758 update libpq.dll to most recent supported version
Submitted: 2020-06-29 15:50 UTC Modified: 2020-08-24 10:47 UTC
Votes:8
Avg. Score:4.4 ± 0.9
Reproduced:7 of 8 (87.5%)
Same Version:3 (42.9%)
Same OS:4 (57.1%)
From: buschmann at nidsa dot net Assigned:
Status: Open Package: PostgreSQL related
PHP Version: 8.0.0beta2 OS: Windows Server 2019 64bit
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: buschmann at nidsa dot net
New email:
PHP Version: OS:

 

 [2020-06-29 15:50 UTC] buschmann at nidsa dot net
Description:
------------
In php8 alpha1 you still deliver libpq version 11.4

The libpq library from Postgres is the central C interface library for clients.

It has a very stable interface, but is regulary updated to reflect security issues and bugs (see PostgreSQL site for more).

A client (here php) connecting to a postgres database through libpq.dll can always connect to elder releases of postgres (e.g. 10.x, 11.x), but newer features for the newest major releases are only supported when using the corresponding libpq.dll.

I have successfully loaded the newest libpq (here: 12.3) through LoadFile in apache httpd.conf and tested the application without issues.

The current version of postgres is 12.3, (12.4 in august, 12.5 in november) and supports compilation under Visual Studio 2019.

At the time of the prospected PHP8 release postgres 13.1 should be out.

Because of the very conservative changing of libpq it should be considered to include libpq from postgres 13 beta during the php alpha and beta phases to switch then to the released version of 13.0 / 13.1 at release time.




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-20 13:42 UTC] cmb@php.net
IMHO, libpq should be updated to version 12 for PHP 8.0, only.
 [2020-08-24 10:47 UTC] buschmann at nidsa dot net
-PHP Version: 8.0.0alpha1 +PHP Version: 8.0.0beta2
 [2020-08-24 10:47 UTC] buschmann at nidsa dot net
PHP 8.0beta2 still contains libpq.dll 11.4.

In the meantime (13.08.2020) PostgreSQL 12.4 is out (the quarterly minor maintenance update of Postgres 12) including the corresponding libpq.dll (version 12.0.4.20223).
With the regular update of Postgres the next version (12.5) comes out on 12.11.2020, just before PHP final schedule.
I suggest to follow the minor upgrades (4/year) to deliver always the latest security fixes of Postgres/libpq.dll.

As an example of the possible problems encountered I show a recent example from our logfiles:

[10-Aug-2020 17:48:20 Europe/Berlin] PHP Notice:  Unknown: Cannot set connection to blocking mode in Unknown on line 0

This occured when using php8.0.x with libpq 11.4 on windows to connect to Postgres 12.4 on Linux.
The PHP Notice seems not to be very helpful in this case (certainly for many non experienced users).

The problem was solved by loading the most recent libq.dll (12.4) in httpd.conf as shown below.

When it is not desired to frequently update libpq.dll as delivered with PHP it should be clearly documented and emphasized that the most recent version of libpq.dll can always be loaded through Apache httpd.conf to get the most recent security fixes and connection features.

For some enhancements with PG 13 see:

https://www.highgo.ca/2020/08/21/tls-related-updates-in-postgresql-13/?utm_source=rss&utm_medium=rss&utm_campaign=tls-related-updates-in-postgresql-13

So I always recommend to load libpq.dll from the (upgraded) Postgres distribution like (here on Windows Drive N:):

<IfModule !php8_module.c>
# libpq has to be loaded first!

# here we try the libpq.dll from php
### DISABLED LoadFile "N:\Apache\php8\libpq.dll"

# here we try the libpq.dll from pgsql bin
LoadFile "N:\pgsql\bin\libpq.dll"

LoadModule php_module "N:\Apache\php8\php8apache2_4.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
# shown here as an example only
PHPIniDir "N:/Apache/Apache24/conf/local"

</IfModule> 


The best would be to provide libpq.dll version 13 at release time of PHP 8 (26.11.2020) as Postgres should come out quite earlier.

Thanks for considering
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 13:01:28 2024 UTC