Welcome Guest, Not a member yet? Register   Sign In
zlib.output_compression problem in CI 4.1.4
#1

(This post was last modified: 10-19-2021, 01:02 AM by BlackBones.)

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!
Reply
#2

/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
Reply
#3

(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.
Reply
#4

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

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
Reply
#6

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

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

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.
Reply
#9

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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB