|
Posted by lawrence k on 12/20/05 18:27
I'm trying to write some RSS feeds. I've created a folder called rss,
and it lives in the same directory as my scripts. I run the script and
get no result. I put in a is_writeable() check and it says the path is
not writeable. I chmod to 777 and get the same result. I fun fileperms
on the folder and it comes back 777. I'm not sure what else to check.
I'm getting this:
> we will try to write the string to rss/cms.xml
> perms are: 16895 0777
> the path rss/cms.xml is not writeable
This is the code right now, full of checks so I can figure out what I'm
doing wrong:
function makeRssFile($string=false, $tag=false) {
$filename = processFileName($tag);
$filename .= ".xml";
if (is_dir("rss/")) {
$path = "rss/".$filename;
$perms = fileperms("rss/");
echo "<p> we will try to write the string to $path <p> perms are:
$perms ";
echo substr(sprintf('%o', fileperms('rss/')), -4);
if (is_writable($path)) {
if (!$handle = fopen($path, 'w+')) {
echo "Cannot open file ($filename)";
exit;
}
if (fwrite($handle, $string) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "\n<p>We just created the file $path";
fclose($handle);
} else {
echo "<p>the path $path is not writeable ";
}
} else {
echo "<p>rss/ is not a directory ";
}
}
Navigation:
[Reply to this message]
|