Why CRONTAB-E cannot execute fwrite write file? Jumped.
function Write_filefun_new ($filename, $filedir, $htmldata = ") {
if (!is_dir ($filedir)) {
mkdir ($filedir, 0777);
}
$htmlfile = $filedir. $filename;
if ($fp = fopen ($htmlfile, ' WBT ')) {
Fwrite ($fp, $htmldata);
Fclose ($FP);
} else {
echo "
Can not write to files, please check the directory $htmldir.
";
Exit
}
}
$testnum _temp= "
";
Write_filefun_new ("test.php", "inc/", $testnum _temp);
Running the page in a browser is normally written,
Set timing in crontab-e every minute does not write to the file, Crontab-e timed execution is normal, can be executed every minute.
Why this, this place is poor, other programs are normal execution, this is not written. Why, Why?
------Solution--------------------
inc/is a relative path
Please figure out who the relative is.
------Solution--------------------
Look at the log, what are the warning messages?
------Solution--------------------
You run the crontab commands directly on the command line to see what happens.
------Solution--------------------
Write an sh, handle the permissions in this file called/usr/bin/php/var/www/html/write.php Last call in crontab using root identity: