How to detect stopping or starting PHP script from background and background

I have this code:

<?PHP
ignore_user_abort(true);
set_time_limit (0);

while(1) {

    // my codes

}
?>

      

now After a while, how to detect if the script is running yet or not?

I used this role for this question:

<?PHP
ignore_user_abort(true);
set_time_limit (0);

while(1) {

    // my codes

    $statusfile = strtolower(file_get_contents('status.txt')); // for stop checking
    if (!(strpos($statusfile,'stop') !== false)) break;

    $status = /* my status */; // for writing status of itself
    file_put_contents('status.txt', $status);

}
?>

      

but in this role, my script itself has to record the status of itself, and if it stopped suddenly (for example, the server is reset or there was an error in the script), it will not write any status, and we cannot define its status as stopped or started.

now i want to know how can i determine runnig status from script from out?

and how can i stop it?

+1
php stopwatch


source to share


No one has answered this question yet

See similar questions:

3
How do I stop a PHP script?

or similar:

2776
How can I prevent SQL injection in PHP?
2335
Removing an element from an array in PHP
2263
How to get YouTube video thumbnail using YouTube API?
2024
How do you parse and process HTML / XML in PHP?
1906
How does PHP foreach work?
1624
How do I get PHP errors?
1192
How do I redirect in PHP?
1085
How to get client IP address in PHP
850
Determining the type of request in PHP (GET, POST, PUT or DELETE)
792
Returning JSON from PHP script



All Articles
Loading...
X
Show
Funny
Dev
Pics