Re: What's the proper way to open a file? File access permissions?
| From: | Jason Wong | Date: | Fri, 14 Feb 2003 19:19:20 +0000 |
| Subject: | Re: What's the proper way to open a file? File access permissions? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135594@lists.php.net to get a copy of this message | ||
On Friday 14 February 2003 16:36, Dunkel wrote:
> How do I ensure that all file access permissions are allowed? What is
> the proper way to do it?
>
> - I tried to 'fopen' an existing text file but got "Permission denied"
> error.
> - I tried different parameters, same error
> - I tried to use 'chmode', same thing
>
> Same thing with different servers so I'm obviously doing something
> wrong. Everything else works fine but the writing doesn't.
>
> The (writing)code is very basic
> (the textfile.txt exists before this):
>
> <?php
>
> $filename = "textfile.txt";
> $somecontent = "the text to add\n";
> $handle = fopen($filename, 'a+w');
> fwrite($handle, $somecontent);
> fclose($handle);
>
> ?>
>
> So, what should I do to get it work?
Try using the /fullpath/to/the/file. If you're in doubt about the permissions
try writing to the system temp directory (/tmp for example).
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Whatever occurs from love is always beyond good and evil.
-- Friedrich Nietzsche
*/