I have done lots of reading on globals, but what I'm seeing seems restricted to a single script.
I have a script that runs constantly on a linux box. The script is executed on box boot up (rc.local kicks it off) then it just loops forever... something to this effect:
while (!$myvar){
sleep 1;
}
Then I want a separate script, actually executed as a web page from apache to occasionally change $myvar to "true", and have the script running on the server to break out of its sleep loop and execute some commands before eventually returning to the sleep loop.
I am able to do this by writing $myvar to mysql or a text file, but the looping / sleeping script needs to query the DB or text file after each second to determine if $myvar has changed or not. This leads to lots of un-necessary queries on the DB.
Does php maintain a "super global" variable array that is readable by all scripts running on the server? The kind of thing where I could use it in a while() loop efficiently. Checking a global like this is probably more efficient than constant file reads or DB queries.
Thanks!