Re: User when script uploads a file?
| From: | Ashley Sheridan | Date: | Tue, 07 Apr 2015 20:03:22 +0000 |
| Subject: | Re: User when script uploads a file? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324776@lists.php.net to get a copy of this message | ||
On Tue, 2015-04-07 at 12:54 -0700, Jeffry Killen wrote:
> Hi again;
>
> I have a CMS that I use locally for dev purposes.
>
> It has a facility for creating a sub directory with the name pattern:
> lab_#
>
> Within each lab_# are directories like lab_#/css, lab_#/js, lab_#/php,
> So I want to upload a file into dev_labs/lab_8/php and the php dir
> has permissions set to 0755 ( web server user is the owner because
> a php script created the dir and sub dirs).
>
> Uploading to the target dir fails with the error write permission
> denied.
>
> So when a file is uploaded via a php script who is the user? (in
> Apache on MacOSX, or any version of a unix system)
>
> Thanks in advance for info
> JK
>
If PHP is responsible for handling the file upload then uploads are
under the user that Apache (or your web server of choice) is running as.
Typically the uploads go to your /tmp directory and are then moved out
by your scripts, but there are directives in Apache to change this
behavior.
I see you have a PHP script create the lab_# directories, but what about
the sub-directories within that? If PHP isn't also creating those, it
could lead to some issues with permissions.
Do you have some sample code that can illustrate the issue, as that
would help highlight any issues that might not be related to
permissions.
Thanks,
Ash
http://www.ashleysheridan.co.uk