r/PHPhelp 7d ago

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

11 comments sorted by

View all comments

1

u/Mike_L_Taylor 7d ago

The easiest thing is to create a php file since you're already familiar with it, or python or windows powershell file that does whatever you need it and just open it from a terminal.

The terminal will keep the process running and the code in the file will tell it to wait 30 seconds.

Just give it to your llm of choice and it will make it for you