Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
As far as I know, when running "manually" the $_SERVER['argc'] and $_SERVER['argv'] variables appear, and other user environment variables also appear.
Hence:
if (isset($_SERVER['argc']) && isset($_SERVER['argv'])) {
define('SELFSERVICE', 1);
}
if (defined('SELFSERVICE')) {
echo "I'm a service";
} else {
echo "I'm a web-dispatcher";
}
curl "http://name.site/script.php?cron=1"
Look at the output
of phpinfo();
for the case when it is opened in the crown and for the case when it is opened through the web server.
And choose for yourself the parameter(s) by which you will determine
For example, like this:
$isCron = !isset($_ENV['SSH_CLIENT']);
But it may depend on the system
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question