Jump to content


This topic is now archived and is closed to further replies.


Cant upload to directory owned by Apache

Recommended Posts

Hello people!

I'm experiencing some problems with my upload script. I have written my own upload script and it uploads to a directory made in that same script. The problem is that due to the SAFE MODE the upload fails.
When I set the permission of the directory to 777 it still doesn't work. I think it has to do with the GID & UID because the directory is Apache and the script-owner is me (ftp account).

I can not alter any settings because I use a webhost.

[b]This is the error:[/b]
Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 558 is not allowed to access /home/ivograsman/domains/ivograsman.nl/public_html/ogp/img/artikelen/2 owned by uid 101 in /home/ivograsman/domains/ivograsman.nl/public_html/ogp/test.php on line 14
[b]There are no $_FILES errors.[/b]

Hope you people can help me!



Share this post

Link to post
Share on other sites

A note on the COPY function on php.net: ## move_uploaded_file Bypasses safe mode and base_dir securities (the function is totally safe, no danger) ##

Here is the function reference:

Note: move_uploaded_file() is not affected by the normal safe mode UID-restrictions. This is not unsafe because move_uploaded_file() only operates on files uploaded via PHP.

Hope it helps.

Share this post

Link to post
Share on other sites
I don't really see what you exactly mean but I've been trying:

To use the copy function which gives the same error. I've checked the manual for move_uploaded_file() and in the Dutch manual @ http://nl3.php.net/manual/nl/function.move-uploaded-file.php

There's the following statement:
[i]Opmerking: Als safe-mode aan staat, zal PHP kijken of de bestanden of directories waarmee je wilt werken dezelfde UID heeft als het script dat wordt uitgevoerd.[/i]
I can not find this sentence in the English manual, weirdly.
Translation is:
[i]Note: If safe-mode is turned ON, PHP will check if the file or directories you choose to work with have the same UID as the executing script[/i]
This sentence describes the problem perfectly, but does not come with a solution.

But I don't get it because you say:
[i]move_uploaded_file() is not affected by the [b]normal[/b] safe mode UID-restrictions[/i]
This situation is then not a 'normal' one I suppose.

Thanks for your help, though I haven't found a solution yet.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.