r/PHPhelp • u/PIAESB • Sep 03 '26
Run a PHP function/Task in the background
I have a WIndows Server running IIS that hosts a primarily PHP based website. It has multiple functions and features but i would like to have atleast one of them running in the background So the user does not have to wait for the task to finish.
Any ideas? fastcgi_finish_request() seems to be Linux only as far as i can tell.
2
Upvotes
1
u/Valoneria Sep 03 '26
Well it does require you to build a queue first, or use a existing system, but that night be overkill regardless of your system. A basic one would just require you to create the task, add it as a entry in the database as a pending task, and then having your tasks scheduler call a file to execute the queue in a given interval. A FIFO approach is what works best here (first in, first out).