M
M
mrnagaron2018-03-27 19:18:55
PHP
mrnagaron, 2018-03-27 19:18:55

How to make script work without user?

Hello, I want to make on my site so that when a person leaves the site, a certain script continues to work on behalf of the user. Who can help or already throw off the mini code.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Anton Shamanov, 2018-03-27
@mrnagaron

You save user tasks in a table, write a script that performs tasks from this table and hang them on cron.

T
tester_toster, 2018-03-27
@tester_toster

you can try pcnt_fork if you need to do something without the user waiting. But a small script run time can be set. There is also fastcgi_finish_request . Give the user data, call the function, the client is given a response, and the script continues to work further.
But still, if this is needed often, it is better to use a queue, since fork creates a copy of the process.

T
Taras Serevann, 2018-03-27
@Taras_Serevann

You buy an Indian on upwork and make you press F5 on the page every 5 seconds

S
Sanovskiy, 2018-03-28
@Sanovskiy

The answer is very easy to google.
php.net/manual/en/function.ignore-user-abort.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question