Re: First time PHP user question
| From: | Nathan Rixham | Date: | Thu, 07 Jan 2010 09:19:24 +0000 |
| Subject: | Re: First time PHP user question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-300877@lists.php.net to get a copy of this message | ||
Rick Dwyer wrote:
> Hello List.
> I have been playing around with PHP, running a few tutorials and I came
> across an error message I could not resolve.
>
> The tutorial is Generating One Time URL's by Oreilly:
>
> http://www.oreillynet.com/pub/a/php/2002/12/05/one_time_URLs.html
>
> Basically the PHP code is supposed to read from a text file and write to
> a text file and serve a text file all located in the "tmp" directory of
> the server.
>
> However, I receive the error that the referenced files in the PHP code
> could not be found:
> "Warning: readfile(/tmp/secret_file.txt) [function.readfile]: failed to
> open stream: No such file or directory
> in/home/mysite/myfolder/get_file.php on line 67"
>
> Line 66 and 67 look like this:
>
> $secretfile = "/tmp/secret_file.txt";
> readfile($secretfile);
>
>
> However, in the tmp folder, I have created a simple text file called
> "secret_file.txt" so I know it exists and it has the permissions set to
> 644, so it should be readable.
>
> Can someone point out to me what I am doing wrong? Thanks,
>
try permissions of 777 and see if the error disappears; odds are v high
that the httpd user php is running under doesn't have group or owner
permissions for /tmp & that secret file.
regards