Jump to content

Safe mode restriction when uploading


rondog

Recommended Posts

I'm installing an app on a clients server and when I try and upload through the form, I get this error:

 

<b>Warning</b>:  move_uploaded_file() [<a href='0function.move-uploaded-file0'>function.move-uploaded-file0</a>]: SAFE MODE Restriction in effect.  The script whose uid is 10053 is not allowed to access /var/www/vhosts/xxxxxxx.ca/httpdocs/clients/project_data/test owned by uid 48 in <b>/var/www/vhosts/xxxxxxx.ca/httpdocs/clients/upload.php</b> on line <b>50</b><br />

 

I've installed this same app on other servers and haven't ran into this problem before. The client is on a shared host so I do not have php.ini access. Any ideas? thanks

Link to comment
https://forums.phpfreaks.com/topic/240832-safe-mode-restriction-when-uploading/
Share on other sites

The owner of the script is not the same as the owner of that directory. Typically, one of those users is you (who uploaded something) and the other is PHP (who created something).

 

One owner needs to own both. If you uploaded the script, delete the current test/ and create it again.

Nope.

 

You could make the PHP script owned by apache:apache, but it's a trick:

1. Rename that script to something else

2. chmod the clients directory to 0777 (if it isn't already)

3a. Write a PHP script to create the real script by copying from the renamed script. You can use file_get_contents and file_put_contents (I don't know if a simple copy() will work)

3b. chmod the new script to 0666

4. Delete the renamed script

5. chmod the clients directory back to whatever it was before - likely 0755 (if you did step 2)

Archived

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

×
×
  • Create New...

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.