permission denied WHY?

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

    permission denied WHY?

    Hi! I wrote this script and executed on my server, with php 4.1.2
    <?php

    $fp = fopen('test.txt ', 'w');
    fwrite($fp, "Bla bla");
    fclose($fp);

    ?>

    it returns this message:
    Warning: fopen("test.txt ", "w") - Permission denied in file.php4 on line 3

    I've tried to change file permissions, change to fopen('test.txt ', 'w+b')
    and other modes. But it doesn´t work.

    Please help!!

    I've seen I can't unlink or rename some files.
  • Randell D.

    #2
    Re: permission denied WHY?


    "JaazzMan" <dontemailme@ne ver.com> wrote in message
    news:Xns93FBA14 2794B4dontemail menevercom@194. 179.3.156...[color=blue]
    > Hi! I wrote this script and executed on my server, with php 4.1.2
    > <?php
    >
    > $fp = fopen('test.txt ', 'w');
    > fwrite($fp, "Bla bla");
    > fclose($fp);
    >
    > ?>
    >
    > it returns this message:
    > Warning: fopen("test.txt ", "w") - Permission denied in file.php4 on line 3
    >
    > I've tried to change file permissions, change to fopen('test.txt ', 'w+b')
    > and other modes. But it doesn´t work.
    >
    > Please help!!
    >
    > I've seen I can't unlink or rename some files.[/color]

    If you cannot unlike/rename files it sounds like a limitation on the
    server - however, to make absolutely sure, I would use the full directory
    path preceeded before the filename in the fopen command, for example

    $fp=fopen("/path/to/your/directory/test.txt", "w+b");

    If that does not solve it... then I'm curious if you are using a third party
    server with restrictive access. Read more on open_basedir
    (http://www.php.net/open_basedir)


    Lastly... Its not a cause, but if you are createing a text file, you
    shouldn't be createing a binary file (thus open the file with "w+" and not
    "w+b")

    hope that helps


    Comment

    Working...