Re: Re: First time PHP user question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ashley Sheridan wrote:
> On Thu, 2010-01-07 at 08:32 -0500, Rick Dwyer wrote:
> 
>> Thanks Ashley & Nathan.
>>
>> As it turns out, there is more than one "tmp" folder... and I was  
>> looking in the wrong one.  When I SSH'd in the correct one, I created  
>> the missing file and it began to work properly.
>> Thanks for chiming in.
>>
>> --Rick
>>
>>
>> On Jan 7, 2010, at 7:58 AM, Ashley Sheridan wrote:
>>
>>> On Thu, 2010-01-07 at 09:19 +0000, Nathan Rixham wrote:
>>>> 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
>>>>
>>>>
>>> That shouldn't fix it. 644 permissions allow the owner, group users  
>>> and anybody else to read file. Have you tried is_file("/tmp/ 
>>> secret_file.txt"); to see if it actually exists? Also, don't forget  
>>> that Linux is case sensitive when it comes to filenames, so  
>>> secret_file.txt is completely different from Secret_File.txt, and in- 
>>> fact you can validly have both in the same directory.
>>>
>>> Thanks,
>>> Ash
>>> http://www.ashleysheridan.co.uk
>>>
>>>
>>
>>   --Rick
>>
>>
>>
> 
> There isn't more than one /tmp folder, that is impossible. There was
> probably more than one tmp folder, and you weren't looking in the right
> one.
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> 
> 

Actually, Ash, you can have more then one /tmp folder.  Depends on what app is
looking at it.

If you have PHP running with Apache and Apache is jailed, the the /tmp folder
would be from the perspective to the jail the the actual OS.

So, if apache was jailed to /var/www/ you could then have a /tmp/ and a
/var/www/tmp/

Apache would never see the /tmp/ only the /var/www/tmp/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux