Re: File Upload Security and chmod
| From: | Andy Hultgren | Date: | Mon, 25 Sep 2006 21:06:34 +0000 |
| Subject: | Re: File Upload Security and chmod | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-242210@lists.php.net to get a copy of this message | ||
Hey Tedd and Eric,
Between the two of you and Richard Lynch's last post, I understand why I can
use chmod() and mkdir() within php without having to use the ftp commands: I
run on a server that is configured to run my php scripts as "username" (ie.
me!) instead of as "nobody" (which is much more common). So my php scripts
have powers which they probably shouldn't have. So, Tedd, you don't have to
go back to the manual it looks like you are exactly right, I'm just on a
goofy server which is the exception to the rule (for better or for worse).
I really appreciate you guys jumping in a giving me a hand. Hopefully I get
good enough at this that I can return the favor sometime!!!
Andy
On 9/25/06, Eric Butera <digital.tarsier@gmail.com> wrote:
On 9/25/06, Andy Hultgren <wearhdphp@gmail.com> wrote: Tedd, Thanks so much your thorough response - it's good to know that I'm not the only one trying to figure this out! I'm curious, in your code you use the PHP ftp functions, but I have used the PHP functions chmod() and mkdir() without establishing an ftp connection. Is it faster to establish an ftp connection within PHP and then use the ftp series of functions to accomplish all of the directory creation and permissions changes? If so, then I will probably change my code to follow yours. Andy By using FTP you can specify which user account you want the connection to be established at. When running a PHP script the script will be running by the Apache server, which means it will have specific permission levels which cannot create directories or chmod unless Apache owns the parent directory. That is why Tedd went through all that trouble.