Click to See Complete Forum and Search --> : [RESOLVED] PHP problem


shane.carr
05-31-2006, 09:05 PM
$messageformated = "This string is 25 lines long"
$dest = blogdest.html

if (is_writable($dest)) {
if (!$handle = fopen($dest, 'a')) {
exit;
}
if (fwrite($handle, $messageformated) === FALSE) {
exit;
/*(((This is line 86)))*/ }
fclose($handle);
}
include("{$dest}");


When I execute this script, I get these warnings:

Warning: main(blogdest.html): failed to open stream: No such file or directory [on my server] on line 86

Warning: main(): Failed opening 'blogdest.html' for inclusion [some path] in [the server] on line 86

I don't know what these mean or how to solve them. What should I do?

It did used to work. I changed something, but I forgot what.

NogDog
05-31-2006, 09:35 PM
My guess is that the is_writeable() is failing. But to help you debug, you might want to output some error data when you exit:

if (is_writable($dest)) {
if (!$handle = fopen($dest, 'a')) {
die("$dest is not writeable");
}
if (fwrite($handle, $messageformated) === FALSE) {
die("Failed to open file $messageformated for writing");
}
fclose($handle);
}
else
{
die("$dest is not writeable");
}
include $dest;

shane.carr
05-31-2006, 09:49 PM
Thanks NogDog, I found the problem. Don't you hate it when you forget one character in the beginning?