Why CRONTAB-E cannot execute fwrite write file? It's jumping.

Source: Internet
Author: User
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:
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.