Run long-term processes until the end

Asked

Viewed 136 times

0

Personal I’m having difficulty for my application to run until the end, and it shows the whole process in real time on the screen using XMLHttpRequest | onprogress and after about just over 2hrs running the browser simply to.

my script is like this:

@ini_set('zlib.output_compression', 0);
@ini_set('output_buffering', 0);
@apache_setenv('no-gzip', 1);
ignore_user_abort(true);
set_time_limit(0);


while (ob_get_level()) ob_end_clean();
ob_implicit_flush();

// vários processos
echo "process..."

I’ve researched A lot about it and much is said in PHP CLI, I ran a test with shell_exec but it does not display in real time as above processes.

Has anyone ever been through this? has any solution?

  • You can use redirect during the process?

  • @Davidjonas where can I get more information about redirect ? would have any idea of implementation? :)

  • @smigol which purpose of this code?

  • I do it on an app, I used that answer, the process lasts +/- 1h and happens without errors. As the manual output_buffering cannot be configured with ini_set(), the configuration shall be made in the .htaccess with php_value output_buffering Off.

  • From the description it seems that the problem is in the browser, not in PHP, you got some error message in the browser console or the browser simply "hangs"? Try to monitor the XHR by aba network

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.