Question

This is the code I'm using, is it enough to make sure the script can be only run as a cron job? It sure does work but maybe there is something I have missed.

   if (php_sapi_name() !== 'cli') {
     die("You are not allwod here");
    }
Was it helpful?

Solution

Yes, that will work. I would also make sure the script is outside the root directory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top