470,826 Members | 1,950 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,826 developers. It's quick & easy.

file is 777 yet is_writeable() says it is not writeable

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 ";
}
}

Dec 20 '05 #1
1 2121
Is safe_mode on?

Dec 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by matt | last post: by
2 posts views Thread by amittewarii | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.