Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

niceteg's avatar

Defer not working and fire 502 error

After moving my app to Laravel Forge (Hetzler vps) code with defer stop working and site return 502 response and only that I can see in log - its PHP error log: WARNING: [pool www] child 86918 exited with code 255 after 22.445599 seconds from start

Do you know what is missing on my new server?

PHP 8.3, Laravel 11.25

0 likes
13 replies
Synt4x's avatar

I have the same issue with Forge, but on a DigitalOcean server, with a slightly different error:

19011 recv() failed (104: Connection reset by peer) while reading response header from upstream

Did you find a solution? The 502 occurs as soon as I use defer, even for a simple Log::info()

1 like
Rockblings's avatar

Have the same issue in forge too. It worked as expected in dev (laravel herd)

1 like
Snapey's avatar

what are you doing that takes 22 seconds?

1 like
niceteg's avatar

@Snapey generate PDF and upload to FTP, but it less than 2 sec, don't know why its 22

puklipo's avatar
puklipo
Best Answer
Level 9

Check if the swoole extension is installed on your server.

php -m | grep swoole

If it is installed, remove swoole.

5 likes
Synt4x's avatar

@puklipo Thanks! I managed to get it working by disabling the swoole extension and then restarting PHP through Forge.

For anyone looking to do the same, I disabled it by moving it outside of the conf folder (in case it's needed again in future): mv /etc/php/8.3/fpm/conf.d/25-swoole.ini /etc/php/8.3/fpm/25-swoole.ini

2 likes
niceteg's avatar

@puklipo yes, $ php -m | grep swoole swoole

thanks for answer! will try this solution

1 like
gklincarski's avatar

Dont uninstall Swoole. Just make sure you are importing the correct function.

use function Illuminate\Support\defer;
2 likes

Please or to participate in this conversation.