Hi friends,
i need a help,
i was set the file in cron job.
that file is also execution in browser also example : http://example.com/cron.php
how can i restrict in browser excution
Thanks Siva kumar
Hi friends,
i need a help,
i was set the file in cron job.
that file is also execution in browser also example : http://example.com/cron.php
how can i restrict in browser excution
Thanks Siva kumar
The easiest and safest method is to remove it from your web root folders. Stick it somewhere else, have it modify its working directory to being work.
Next best would be to tell your web server not to serve that file. (i.e. .htaccess file for Apache).
You could also detect HTTP Post/Get variables and that would tell you if it is a command line vs web request.
Jacob
You can detect if its cli or not with php_sapi_name or its constant.
if (PHP_SAPI !== 'cli') {
//not cli
}