note 75654 added to function.move-uploaded-file
| From: | bogusred at osu1 dot php dot net | Date: | Sun, 10 Jun 2007 20:58:18 +0000 |
| Subject: | note 75654 added to function.move-uploaded-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127366@lists.php.net to get a copy of this message | ||
If you have a directory in a *nix environment where you store all of your file uploads and your php
script only seems to work when permissions for that directory are set to 777, here's how to fix
it so that you can have the security benefits of 755 while still allowing your php scripts to work,
including the move_uploaded_file().
through shell access, navigate to the directory that contains your uploads folder and run the
following 2 commands:
chown -R nobody uploaddir
chmod -R 755 uploaddir
Replace 'uploaddir' with the name of your uploads directory. The first command changes the
owner of the directory and files to 'nobody' which is what php operates under. The second
changes the folder and files to only allow user access to writing. This is much more secure.
Hopefully this will help someone out there who had the same problem as me.
----
Server IP: 69.147.83.197
Probable Submitter: 67.119.12.178
----
Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php
Edit -- https://master.php.net/note/edit/75654
Del: integrated -- https://master.php.net/note/delete/75654/integrated
Del: useless -- https://master.php.net/note/delete/75654/useless
Del: bad code -- https://master.php.net/note/delete/75654/bad+code
Del: spam -- https://master.php.net/note/delete/75654/spam
Del: non-english -- https://master.php.net/note/delete/75654/non-english
Del: in docs -- https://master.php.net/note/delete/75654/in+docs
Del: other reasons-- https://master.php.net/note/delete/75654
Reject -- https://master.php.net/note/reject/75654
Search -- https://master.php.net/manage/user-notes.php