• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Issue PHP connection_status and connection_aborted always 0

AlwinLubbers

New Pleskian
Server operating system version
Debian 11.8
Plesk version and microupdate number
Plesk Obsidian v18.0.56_build1800231106.15
Hi there, I'm trying to setup an EventSource stream for server side events with PHP.

My script checks whether the connection is still active using connection_status() and connection_aborted(). It works flawlessly on my Mac with Apache 2.2.4.57 using default configs. It doesn't work on my webserver with Plesk 18.0.56 using default configurations. Both connection_status() and connection_aborted() will always be '0', telling my script that the connection is still active, even if the client is not connected anymore. Removing Nginx and going with Apache only did not work.

I've tried both PHP 8.2.12 Dedicated FPM served by Apache and Dedicated FPM served by Nginx. Both give the same result, with the Nginx handler giving an additional error:
Code:
1327235#0: *122924 upstream timed out (110: Connection timed out) while reading response header from upstream

These are the headers that are being sent by my PHP script:
PHP:
ignore_user_abort(true);
set_time_limit(0);

header('X-Accel-Buffering: no');
header('Connection: keep-alive');
header('Cache-Control: no-cache');
header('Transfer-Encoding: chunked');
header('Content-Type: text/event-stream');
header('Access-Control-Allow-Origin: *');

Which are the right headers to get SSE to show up. The code that handles the connection looks like:
PHP:
while (true) {
    echo "data: \n\n";
    ob_flush();
    flush();
    set_time_limit(0);

    if(connection_status() != 0 || connection_aborted() != 0) break;
}

There is almost no info available about similar problems while using SSE in combination with Plesk, since most use socket instead of eventsource.

I'm happy to provide more info if needed. Thanks!
 
Back
Top