[PHP] Re: PHP (under httpd) reading a file outside DocumentRoot?

2008-12-27 Thread Jeff Weinberger

On Dec 26, 2008, at 1:52 PM, Nathan Rixham wrote:


Jeff Weinberger wrote:
I don't know if this is an Apache (httpd) or a PHP issue (I suspect  
PHP, but I may be doing something wrong with mod_suexec), so I hope  
this is the right place to ask. I certainly appreciate any help  
anyone can offer!
I am trying to get a PHP script to read a file that's outside the  
DocumentRoot of a VirtualHost, in fact well outside the parent  
directory of all of my virtual hosts.
I have successfully managed to get Apache httpd to run the script  
as the correct user and group (matching the target file's  
ownership) using SuexecUserGroup. I tested this by having the  
script create/write a test file, which had owner and group set  
correctly.
However, when I run the script, at the file(/path/to/target/file)  
command, PHP tells me it can't open the file - permission is denied.

In php.ini safe_mode is off and open_basedir is not set.
I am not sure where else to look for a solution - any help is very  
much appreciated!
FYI: PHP 5.2.6, Apache httpd 2.2.11, mod_ssl/2.2.11, OpenSSL/0.9.7l  
on Mac OS/X 10.5.5. I'm reaching the script over an SSL (https)  
connection if that matters).

Thanks!


do what it takes to make it work (ie chmod 777 or similar) then put  
things back to how they presently are one by one to find the cause  
of the error. :)


Nathan: Thanks for your suggestion - a good debugging step - but the  
permissions on the file I want the script to read have been -rw-rw-rw-  
the entire time.


This leads me to suspect that the issue is not the permissions  
themselves, but rather something about my PHP configuration or script  
(or, possibly, as I noted, my Apache httpd configuration) that is  
causing PHP to report a permission error on reading the file.


I don't know where else to look for this issue, so I hope that someone  
has at least some pointers or suggestions on what might be happening  
here.


Thank you very much for any help!

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



[PHP] Re: PHP (under httpd) reading a file outside DocumentRoot?

2008-12-26 Thread Nathan Rixham

Jeff Weinberger wrote:
I don't know if this is an Apache (httpd) or a PHP issue (I suspect PHP, 
but I may be doing something wrong with mod_suexec), so I hope this is 
the right place to ask. I certainly appreciate any help anyone can offer!


I am trying to get a PHP script to read a file that's outside the 
DocumentRoot of a VirtualHost, in fact well outside the parent directory 
of all of my virtual hosts.


I have successfully managed to get Apache httpd to run the script as the 
correct user and group (matching the target file's ownership) using 
SuexecUserGroup. I tested this by having the script create/write a test 
file, which had owner and group set correctly.


However, when I run the script, at the file(/path/to/target/file) 
command, PHP tells me it can't open the file - permission is denied.


In php.ini safe_mode is off and open_basedir is not set.

I am not sure where else to look for a solution - any help is very much 
appreciated!


FYI: PHP 5.2.6, Apache httpd 2.2.11, mod_ssl/2.2.11, OpenSSL/0.9.7l on 
Mac OS/X 10.5.5. I'm reaching the script over an SSL (https) connection 
if that matters).


Thanks!


do what it takes to make it work (ie chmod 777 or similar) then put 
things back to how they presently are one by one to find the cause of 
the error. :)


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