Jump to content
View in the app

A better way to browse. Learn more.

Froxlor Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Froxlor > Wechsel Apache PHP > PHP_FPM > ob_flush etc. geht nicht mehr - Was ist fehlerhaft konfiguriert

Featured Replies

Hallo zusammen, 

wir haben Jahrelang einen Debian 10 Server mit Froxlor und php7.3 genutzt und haben jetzt auf einen neuen Server mit Debain 12 und PHP [7.3|8.1|8.2] FPM gewechselt. 

Seit dem funktioniert keine live Ausgabe in den Scripts mehr:

Simples Beispiel:

``` php 

if (ob_get_level() == 0) ob_start();
for ($i = 0; $i<3; $i++){
 
echo "<br> Line to show.";
echo str_pad('',4096)."\n";
 
ob_flush();
flush();
sleep(1);
}
 
echo "Done.";
 
ob_end_flush();


```

Ich habe wirklich sehr viel gelesen und die Settings geprüft, ich finde den Fehler aber nicht. 


Settings die dafür verantwortlich sein sollen:
php.ini
```
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off

```

Funktioniert aber nicht, es wird immer erst ausgegeben, wenn das Script beendet ist.

Kann mit da jemand helfen oder eine Info geben, was das sein könnte? 

 

 

Solved by d00p

Go to solution

Hast du denn sichergestellt das in der genutzten PHP Version und der zugehörigen php-konfiguration der Domain die geforderten settings auch so gesetzt sind (z.b. via phpinfo())

  • Author

Hey, 

 

vielen Dank für die schnelle Antwort 🙂

 

Leider Ja 🙂 

 

Ich habe im Test-Script phpinfo() direkt ausgegeben um sicher zu gehen, dass das auch genau die Version ist, die ich nutze. 

 

 

 

Directive Local Value Master Value
zlib.output_compression Off Off
zlib.output_compression_level -1 -1
zlib.output_handler no value no value

 

html_errors On On
ignore_repeated_errors Off Off
ignore_repeated_source Off Off
ignore_user_abort On Off
implicit_flush Off Off
include_path .:/var/customers/webs/stoll/yii/protected/extensions/EExcelView:/var/customers/webs/stoll/yii/protected/components:/var/customers/webs/stoll/yii/protected/models:/usr/share/php .:/usr/share/php
input_encoding no value no value
internal_encoding no value no value
log_errors On On
log_errors_max_len 1024 1024
mail.add_x_header Off Off
mail.force_extra_parameters no value no value
mail.log no value no value
max_execution_time 0 3600
max_file_uploads 20 20
max_input_nesting_level 64 64
max_input_time 240 240
max_input_vars 1000 1000
max_multipart_body_parts -1 -1
memory_limit 4048M 4048M
open_basedir no value no value
output_buffering 4096 4096
output_encoding no value no value
output_handler no value no value
post_max_size 256M 256M

Und nix in der Error Log oder php-fpm log?

Ich kanns leider Grad selbst nicht testen, nur unterwegs am Smartphone 

  • Solution

Folgendes Beispiel funktioniert bei mir unter nginx genauso wie unter apache mit php-fpm:

 

<?php

function doFlush()
{
        if (!headers_sent()) {
                // Disable gzip in PHP.
                ini_set('zlib.output_compression', 0);

                // Force disable compression in a header.
                // Required for flush in some cases (Apache + mod_proxy, nginx, php-fpm).
                header('Content-Encoding: none');
        }

        // Fill-up 4 kB buffer (should be enough in most cases).
        echo str_pad('', 4 * 1024);

        // Flush all buffers.
        do {
                $flushed = @ob_end_flush();
        } while ($flushed);

        @ob_flush();
        flush();
}

// In a real app, we have this turned on.
ob_start();

$i = 0;
while ($i++ < 10) {
        usleep(500000);

        // Real output.
        echo $i . "\n<br>";

        doFlush();
}

 

  • Author

UFF, I don't get it warum das funktioniert und mein alter code nicht, der auch noch ohne FPM läuft,... aber,... es läuft 😄

V I E L E N 

D A N K

Hast du irhendwo einen Link von BuyMeACoffee oder so? 

 

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.