Reputation: 46
In php how to get last execution time of a specific file? I am working on a plugin which is a cron job and I want its last execution time. how can i get it? Actually problem is suppose due to some problem my is not executed then how can I know what was it's last execution time.
Upvotes: 0
Views: 1039
Reputation: 10603
Best option would be too use a database (a flat file database like a simple text file would be fine) and store the time so you can read it later.
But if thats not an option try using the fileatime(). It should work fine as long as your cron job is the only one accessing the file in question
http://www.php.net/manual/en/function.fileatime.php
Upvotes: 0