Viewed   68 times

I'm trying to make a PHP script, I have the script finished but it takes like 10 minutes to finish the process it is designed to do. This is not a problem, however I presume I have to keep the page loaded all this time which is annoying. Can I have it so that I start the process and then come back 10mins later and just view the log file it has generated?

 Answers

3

Well, you can use "ignore_user_abort(true)"

So the script will continue to work (keep an eye on script duration, perhaps add "set_time_limit(0)")

But a warning here: You will not be able to stop a script with these two lines:

ignore_user_abort(true); 
set_time_limit(0);

Except you can directly access the server and kill the process there! (Been there, done an endless loop, calling itself over and over again, made the server come to a screeching stop, got shouted at...)

Friday, September 30, 2022
2

Problem solved with the following command:

$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("C:wampbinphpphpVERSIONNUMBERphp-win.exe -f C:/wamp/www/path/to/backgroundProcess.php", 0, false);
Friday, December 9, 2022
2
  1. create a batch file to run your php script using php executable "C:wampphpphp.exe C:wampwwwindex.php"
  2. add this batch file in Scheduled Task in Windows control panel.
Sunday, December 11, 2022
 
pam_ix
 
4

It's not possible use a PHP file served by a HTTP Server because all proceses will die after the request end.

So cPanel cron is a good option, you don't need to have the cron entry always enable, just setup once the entry and disable it after the script start to run.

Only you'll need add & at the end of your cron command to make it run as background.

Tuesday, August 30, 2022
3

So, what are "cached background processes"?

Since you are asking for a technical interpretation of something listed in a device UI, the definition may vary by device, if device manufacturers elected to tinker with the Settings app.

That being said, "cached background processes" usually refers to processes that do not have a foreground activity and do not have a running service. These processes are kept in memory simply because we have enough memory to do so, and therefore, as you note, the user can switch back to these processes quickly. As Android starts to need more system RAM for yet other processes, the "cached background processes" tend to be the processes that get terminated to free up system RAM.

The pre-eminent example of a "cached background process" would be one where the user launched the app, poked around it briefly, then pressed HOME to return to the home screen. If the process does not have a running service, I would expect to find it listed as a "cached background process".

They are still in memory, rather than switched to "disk" (as desktops/laptops do), right?

Correct. Android devices do not use swap space.

Friday, August 26, 2022
 
anes08
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :