Hello all,
I am hoping someone can help me to solve a problem that I'm having with running a PHP script via crontab...the script works perfectly fine in the web browser, but when it executes via Cron, I get the following errors:
failed to create stream: No such file or directory in /home/www/directory/admin/admin_auto_cues_email.php on line 116
Warning: fwrite(): supplied argument is not a valid stream resource in /home/www/directory/admin/admin_auto_cues_email.php on line 117
Warning: fopen(/includes/templates/emails/files/5.txt) [http://www.php.net/function.fopen]:
failed to create stream: No such file or directory in /home/www/directory/admin/admin_auto_cues_email.php on line 132
Warning: fwrite(): supplied argument is not a valid stream resource in /home/www/directory/admin/admin_auto_cues_email.php on line 133
Warning: fopen(/includes/templates/emails/files/5.txt) [http://www.php.net/function.fopen]:
failed to create stream: No such file or directory in /home/www/directory/admin/admin_auto_cues_email.php on line 138
Warning: fwrite(): supplied argument is not a valid stream resource in /home/www/directory/admin/admin_auto_cues_email.php on line 139
Warning: fopen(/includes/templates/emails/files/5.txt) [http://www.php.net/function.fopen]:
failed to create stream: No such file or directory in /home/www/directory/admin/admin_auto_cues_email.php on line 141
Here are the corresponding codes where those errors in the script where these errors are occuring:
$file = fopen ($_SERVER['DOCUMENT_ROOT'] . "/includes/templates/emails/files/" . $my_file_name,"w");
$fout = fwrite ($file, $insert_header);
clearstatcache();
while ($cue_row = mysql_fetch_array($cue_get_result)) {
$cue_typeid = $cue_row[0];
$cue_type = $cue_row[1];
$cue_text = $cue_row[2];
$cue_type_ext = $cue_row[3];
if ($debug == "on") {
print'USERID: ';echo $my_userid; print '- Cues Sent';
}
$insert_message = "
<!-- NEW RECORD -->
After reading your profile another EnneaMates member is " . $cue_text . "! <img src='http://" . $server_name . $GLOBALS['file_emoticons_relpath'] . "/" . $cue_typeid . "." . $cue_type_ext . "' alt='" . $cue_type . "'>
";
// Append Messages to File
$file = fopen ($_SERVER['DOCUMENT_ROOT'] . "/includes/templates/emails/files/" . $my_file_name,"a");
$fout = fwrite ($file, $insert_message);
clearstatcache();
}
// Build Footer of File
$insert_footer = "";
$file = fopen ($_SERVER['DOCUMENT_ROOT'] . "/includes/templates/emails/files/" . $my_file_name,"a");
$fout = fwrite ($file, $insert_top_footer);
clearstatcache();
$file = fopen ($_SERVER['DOCUMENT_ROOT'] . "/includes/templates/emails/files/" . $my_file_name,"a");
$fout .= fwrite ($file, $insert_footer);
clearstatcache();
$file = fopen ($_SERVER['DOCUMENT_ROOT'] . "/includes/templates/emails/files/" . $my_file_name,"a");
$fout .= fwrite ($file, $insert_bottom_footer);
fclose ( $file );
clearstatcache();
BTW: I've spend a number of hours searching through PHP.net, PHPBuilder, Google, etc., and can't come up a concrete solution for the above problem.
I'd like to solve this problem ASAP...since the emails need to be sending on a consistent basis...
Any suggestions are direct links to possibly solutions would be greatly appreciated.
Thanks in advance.
========================================
Buh Bye!
Cheers,
Me
I am hoping someone can help me to solve a problem that I'm having with running a PHP script via crontab...the script works perfectly fine in the web browser, but when it executes via Cron, I get the following errors:
Code:
Warning: fopen(/includes/templates/emails/files/5.txt) [http://www.php.net/function.fopen]: failed to create stream: No such file or directory in /home/www/directory/admin/admin_auto_cues_email.php on line 116
Warning: fwrite(): supplied argument is not a valid stream resource in /home/www/directory/admin/admin_auto_cues_email.php on line 117
Warning: fopen(/includes/templates/emails/files/5.txt) [http://www.php.net/function.fopen]:
failed to create stream: No such file or directory in /home/www/directory/admin/admin_auto_cues_email.php on line 132
Warning: fwrite(): supplied argument is not a valid stream resource in /home/www/directory/admin/admin_auto_cues_email.php on line 133
Warning: fopen(/includes/templates/emails/files/5.txt) [http://www.php.net/function.fopen]:
failed to create stream: No such file or directory in /home/www/directory/admin/admin_auto_cues_email.php on line 138
Warning: fwrite(): supplied argument is not a valid stream resource in /home/www/directory/admin/admin_auto_cues_email.php on line 139
Warning: fopen(/includes/templates/emails/files/5.txt) [http://www.php.net/function.fopen]:
failed to create stream: No such file or directory in /home/www/directory/admin/admin_auto_cues_email.php on line 141
Here are the corresponding codes where those errors in the script where these errors are occuring:
Code:
$my_file_name = $my_userid . ".txt"; $file = fopen ($_SERVER['DOCUMENT_ROOT'] . "/includes/templates/emails/files/" . $my_file_name,"w");
$fout = fwrite ($file, $insert_header);
clearstatcache();
while ($cue_row = mysql_fetch_array($cue_get_result)) {
$cue_typeid = $cue_row[0];
$cue_type = $cue_row[1];
$cue_text = $cue_row[2];
$cue_type_ext = $cue_row[3];
if ($debug == "on") {
print'USERID: ';echo $my_userid; print '- Cues Sent';
}
$insert_message = "
<!-- NEW RECORD -->
After reading your profile another EnneaMates member is " . $cue_text . "! <img src='http://" . $server_name . $GLOBALS['file_emoticons_relpath'] . "/" . $cue_typeid . "." . $cue_type_ext . "' alt='" . $cue_type . "'>
";
// Append Messages to File
$file = fopen ($_SERVER['DOCUMENT_ROOT'] . "/includes/templates/emails/files/" . $my_file_name,"a");
$fout = fwrite ($file, $insert_message);
clearstatcache();
}
// Build Footer of File
$insert_footer = "";
$file = fopen ($_SERVER['DOCUMENT_ROOT'] . "/includes/templates/emails/files/" . $my_file_name,"a");
$fout = fwrite ($file, $insert_top_footer);
clearstatcache();
$file = fopen ($_SERVER['DOCUMENT_ROOT'] . "/includes/templates/emails/files/" . $my_file_name,"a");
$fout .= fwrite ($file, $insert_footer);
clearstatcache();
$file = fopen ($_SERVER['DOCUMENT_ROOT'] . "/includes/templates/emails/files/" . $my_file_name,"a");
$fout .= fwrite ($file, $insert_bottom_footer);
fclose ( $file );
clearstatcache();
BTW: I've spend a number of hours searching through PHP.net, PHPBuilder, Google, etc., and can't come up a concrete solution for the above problem.
I'd like to solve this problem ASAP...since the emails need to be sending on a consistent basis...
Any suggestions are direct links to possibly solutions would be greatly appreciated.
Thanks in advance.
========================================
Buh Bye!
Cheers,
Me