go to bug id or search bugs for
If using the PDO driver with the pgsql driver it appears that the ini max memory limits are NOT obeyed while the driver fetches the results. This allows for a large query (ie select * from table) to go well above the memory limits that the php.ini specifies.
I would expect the PHP.ini memory limits to cause an out of memory limit/kill it if the amount of allocated space on the driver exceeds the configured memory limit.
Add a Patch
Add a Pull Request
I can understand your frustration with this, but it is not actually fixable unless there will be a complete implementation of the pgsql C client library using PHP/Zend APIs. This is what MySQL has with mysqlnd, as such this cannot happen with MySQL.
But Postgresql client library doesn't use PHPs memory management and goes around the memory limit for this reason.
As you can read here somebody requested the feature for libpq to replace the memory allocator, but nothing much has happened: https://www.postgresql.org/message-id/20170828172834.GA71455%40TC.local
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php