Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Apr 2009
    Posts
    135
    Thanks
    83
    Thanked 0 Times in 0 Posts

    Problem With FWrite Within A Cronjob

    I have the following file:

    PHP Code:
    <?php
    $ccyymmdd 
    date("Y - m - d (G,i)");
    $file fopen("dbbackups/".$ccyymmdd.".php","w");
    // Write stuff here
    fclose($file);
    ?>
    When run from my browser it works fine. When I run from a cron job my Cron Daemon sends me a report:

    Warning: fopen(dbbackups/2009 - 10 - 25 (11,10).php): failed to open stream: No such file or directory in /home/xxxxx/public_html/dbbackupcron.php on line 7
    My Cron:
    /usr/local/bin/php -q /home/xxxxxxx/public_html/dbbackupcron.php

    Anyone know a work around for this? Perhaps using CURL instead of PHP?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    You may need to use the absolute path to refer that file.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    Sussex_Chris (10-25-2009)

  • #3
    Regular Coder
    Join Date
    Apr 2009
    Posts
    135
    Thanks
    83
    Thanked 0 Times in 0 Posts
    Got it working with CURL in the end, thanks for your help


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •