I want to run a php script in the background and save its PID in the database. So I can check if a particular script is working or not (later).
We can use getmypidto get the current PID.
But according to the PHP manual
Process identifiers are not unique; therefore, they are a weak source of entropy. We recommend that you do not rely on pids in security-dependent contexts.
... and I cannot rely on PID.
My second idea is to save the time created by the process into the database.
How can I get the current script time? And later, how can I compare with tasklist to check if a particular script is working?
I am running a shared host, windows / linux environment.
source
share