Answer the question
In order to leave comments, you need to log in
Why doesn't php script work with cron?
Tell me, what could be wrong here?
If I write another code, say, to write the word "hello" to a file, then the scheduler will execute the task, but if I write such code, it does not.
Could this be due to the use of Read Bean Php?
<?php
include './system/db/connect.php';
if($user->hp < $user->max_hp){
$hp = $user->max_hp/100*10;
$user->hp += $hp;
R::store($user);
}
?>
Answer the question
In order to leave comments, you need to log in
Write in the cron to save the output to a file, most likely there will be an error text.
In telepath mode, I can assume that the problem is with the inclusion path.
In any case, this piece of code can be guessed ad infinitum, we need logs.
99% that the problem is here: "include './system/db/connect.php';"
This command is executed relative to the current directory.
And what is the current directory when you call your php file from cron do you know?
Add some cd thread or specify the full path everywhere and try again.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question