Oziam Posted October 18, 2010 Share Posted October 18, 2010 Hope someone can help me! I have an upload script that stores users files, it creates a dir using the users name which will store their uploads! The problem is because I am on a shared host with safe mode ON i get an error when trying to upload to that directory via a form, the error says something like SAFE MODE Restriction in effect. The script whose uid is 500 is not allowed to access /proc/uptime owned by uid 0 in ...... If I create a dir manually(FTP) it works fine! But I cannot obviously create a dir for each new user as the registration is automatic, so at the moment I have 1 common dir for all users to upload to, but this will eventually cause too much congestion and slow things down! Any ideas! Thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/216118-mkdir-uid-safemode-problem/ Share on other sites More sharing options...
BlueSkyIS Posted October 18, 2010 Share Posted October 18, 2010 one idea: use php to ftp the files to the same server via server ip address or localhost? never tried it, just an idea. Quote Link to comment https://forums.phpfreaks.com/topic/216118-mkdir-uid-safemode-problem/#findComment-1123144 Share on other sites More sharing options...
Oziam Posted October 18, 2010 Author Share Posted October 18, 2010 Great idea and it would work, but all ftp functions have been disabled! Quote Link to comment https://forums.phpfreaks.com/topic/216118-mkdir-uid-safemode-problem/#findComment-1123149 Share on other sites More sharing options...
BlueSkyIS Posted October 18, 2010 Share Posted October 18, 2010 after you create the user directory, do you try to perform chmod() on it? my understanding of safe mode is that you can still upload, but not to outside of your web root. of course, i may be wrong about that... Quote Link to comment https://forums.phpfreaks.com/topic/216118-mkdir-uid-safemode-problem/#findComment-1123154 Share on other sites More sharing options...
Oziam Posted October 18, 2010 Author Share Posted October 18, 2010 Yes I do chmod the dir! my code is similar to below; if (!is_dir($this->dir)){ mkdir($this->dir); chmod($this->dir, 0777); } I have also tried; mkdir($this->dir, 0777); mkdir($this->dir, 1777); mkdir($this->dir, 4777); and if (!is_dir($this->dir)){ $oldumask = umask(0); mkdir($this->dir, 0777); umask($oldumask); } and I have even tried to change the uid to nobody! posix_setgid(99); posix_setuid(99); also the dir is created inside the root e.g root/usr_img/username/ Quote Link to comment https://forums.phpfreaks.com/topic/216118-mkdir-uid-safemode-problem/#findComment-1123158 Share on other sites More sharing options...
BlueSkyIS Posted October 18, 2010 Share Posted October 18, 2010 ay caramba, you've tried everything i would suggest. maybe someone else has an idea. Quote Link to comment https://forums.phpfreaks.com/topic/216118-mkdir-uid-safemode-problem/#findComment-1123159 Share on other sites More sharing options...
DavidAM Posted October 18, 2010 Share Posted October 18, 2010 ... The script whose uid is 500 is not allowed to access /proc/uptime owned by uid 0 in ...... Are you sure that you are specifying the directory name correctly? That error message indicates you are trying to access /proc/uptime which is owned by root. Quote Link to comment https://forums.phpfreaks.com/topic/216118-mkdir-uid-safemode-problem/#findComment-1123174 Share on other sites More sharing options...
Oziam Posted October 18, 2010 Author Share Posted October 18, 2010 Actually proc/uptime is just an example error message from another post, the actual path is the path to the dir. Quote Link to comment https://forums.phpfreaks.com/topic/216118-mkdir-uid-safemode-problem/#findComment-1123187 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.