CodeIgniter Forums
zlib.output_compression problem in CI 4.1.4 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: zlib.output_compression problem in CI 4.1.4 (/showthread.php?tid=80333)



zlib.output_compression problem in CI 4.1.4 - BlackBones - 10-19-2021

Anybody help???
I have just uploaded a CI4 project (latest version 4.1.4) to cPanel but no views are rendered.
The error displayed is:
CodeIgniter\Exceptions\FrameworkException
Your zlib.output_compression ini directive is turned on. This will not work well with output buffers.

I turned off the directive in php.ini but this time an ErrorException#1 error was encountered.

Thanks!


RE: zlib.output_compression problem in CI 4.1.4 - devprecious - 10-19-2021

/app/Config/Events.php
Removing this code in app/Config/Events.php, or turning off output_compression in php.ini is a temp solution.

while (\ob_get_level() > 0)
 {
  \ob_end_flush();
 }

 \ob_start(function ($buffer) {
  return $buffer;
 });

You can just comment it out


RE: zlib.output_compression problem in CI 4.1.4 - BlackBones - 10-19-2021

(10-19-2021, 10:57 AM)devprecious Wrote: /app/Config/Events.php
Removing this code in app/Config/Events.php, or turning off output_compression in php.ini is a temp solution.

while (\ob_get_level() > 0)
 {
  \ob_end_flush();
 }

 \ob_start(function ($buffer) {
  return $buffer;
 });

You can just comment it out

Thanks @devprecious, I did that before, and it made no difference.
Still trying to find a solution though.


RE: zlib.output_compression problem in CI 4.1.4 - roberfu - 10-20-2021

I just set my environment on testing, its an awful solution but is something.


RE: zlib.output_compression problem in CI 4.1.4 - SoccerGuy3 - 10-20-2021

What version of PHP. We had issues with PHP8 and cPanel working correctly with CI. IIRC cpanel's version of PHP 8 doesn't currently support the international plugin and that will throw a #1 error


RE: zlib.output_compression problem in CI 4.1.4 - roberfu - 10-20-2021

In my case, php versions:
Cpanel 7.4
Server 7.3
Localhost 7.4


RE: zlib.output_compression problem in CI 4.1.4 - roberfu - 10-20-2021

The optimal soluciton to this problem is changing some lines in the cpanel php.ini


RE: zlib.output_compression problem in CI 4.1.4 - BlackBones - 10-22-2021

Thanks for your suggestion guys.

What I did to resolve the problem was to upgrade to PHP 7.4 from PHP 7.3, enable all required PHP and MySQL extensions, with the zlib.output_compression turned off.


RE: zlib.output_compression problem in CI 4.1.4 - karman - 10-25-2021

Just had same issue.

When you do "var_dump(ini_get('zlib.output_compression')))" the output is string(3) "Off"
So the code in events.php line 28 "if (ini_get('zlib.output_compression'))" will resovlve to "true" as the string "off" is seen as not false.

Not sure if php maybe changed something on the query, but I think the CI "if" statement should be updated to check if its on really on.