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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lawrence k

    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:
    [color=blue]
    > we will try to write the string to rss/cms.xml
    > perms are: 16895 0777
    > the path rss/cms.xml is not writeable[/color]



    This is the code right now, full of checks so I can figure out what I'm
    doing wrong:


    function makeRssFile($st ring=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($p ath)) {
    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 ";
    }
    }

  • Chung Leong

    #2
    Re: file is 777 yet is_writeable() says it is not writeable

    Is safe_mode on?

    Comment

    Working...