• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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