...

View Full Version : Problem With FWrite Within A Cronjob



Sussex_Chris
10-25-2009, 05:19 PM
I have the following file:



<?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?

abduraooft
10-25-2009, 05:52 PM
You may need to use the absolute path to refer that file.

Sussex_Chris
10-25-2009, 06:21 PM
Got it working with CURL in the end, thanks for your help



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum