X
X
XenK2015-03-14 22:24:51
PHP
XenK, 2015-03-14 22:24:51

How to disable script execution except for cron?

It is necessary to prohibit the execution of the script (direct transition), while having the cron run this script. Is it possible to?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
olamedia., 2015-03-14
@XenK

if (PHP_SAPI != 'cli'){
  die('Не консоль');
}

R
rapkin, 2015-03-14
@rapkin

Maybe. The server runs under its www-data user, you run crons on your behalf, so you need to set the appropriate execution rights (750 if I'm not mistaken).
chmod 0750 file.php76943f3d392e4d25a8e50b1381e49a54.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question