About Cron Jobs

liunx

Guest
Hello.<br /><br />I am a new to this and I need help.<br />I use a simple php file for test.<br /><br />Command to run: php /home/username/test.php<br />test.php:<br /><?php<br />$starttime = time();<br />$fp = fopen('time.inc', 'w+');<br /><br />if($fp)<br />{<br />fwrite($fp, $starttime);<br />fclose($fp);<br />}<br />?><br /><br />why can't get any result?<!--content-->
Welcome to the forums wryd <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br /><br />In your fopen statement there is no path to the file you are trying to open.<!--content-->
Welcome to the forum, wryd. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
<!--quoteo(post=188231:date=Aug 17 2006, 07:39 AM:name=TCH-Bruce)--><div class='quotetop'>QUOTE(TCH-Bruce @ Aug 17 2006, 07:39 AM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=188231"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->Welcome to the forums wryd <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br /><br />In your fopen statement there is no path to the file you are trying to open.<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br /><br />Thanks. but how to write str to a file?<!--content-->
You need to change your fopen to include the path to where you want to create the file.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->$fp = fopen('/home/yourCpanelname/path-to/time.inc', 'w');<!--c2--></div><!--ec2--><!--content-->
<!--quoteo(post=188237:date=Aug 17 2006, 09:19 AM:name=TCH-Bruce)--><div class='quotetop'>QUOTE(TCH-Bruce @ Aug 17 2006, 09:19 AM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=188237"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->You need to change your fopen to include the path to where you want to create the file.<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->$fp = fopen('/home/yourCpanelname/path-to/time.inc', 'w');<!--c2--></div><!--ec2--><!--QuoteEnd--></div><!--QuoteEEnd--><br /><br /><br /> <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/clapping.gif" style="vertical-align:middle" emoid=":clapping:" border="0" alt="clapping.gif" /> Thanks. It's OK.<!--content-->
Glad I could help<!--content-->
 
Top