paulferree Posted June 2, 2010 Share Posted June 2, 2010 I have an open source app thats throwing this error: Warning: copy() [function.copy]: open_basedir restriction in effect. File(C:\Windows\Temp\php7318.tmp) is not within the allowed path(s): ([*path on server to specific account*]) The global open_basedir is set to no value (commented out) and when I run phpinfo on this account it is set to the specific site location on the server. Safe mode is not on FYI Why is it trying to write to a windows Temp folder instead of the local path? How do I resolve this? Thanks! Paul Quote Link to comment https://forums.phpfreaks.com/topic/203690-open_basedir-restriction-error/ Share on other sites More sharing options...
Daniel0 Posted June 2, 2010 Share Posted June 2, 2010 Why is it trying to write to a windows Temp folder instead of the local path? Because that's apparently where you're copying to/from. Check your code for a call to copy(). How do I resolve this? Either stay within the paths specified in open_basedir, or turn it off. Quote Link to comment https://forums.phpfreaks.com/topic/203690-open_basedir-restriction-error/#findComment-1066891 Share on other sites More sharing options...
paulferree Posted June 3, 2010 Author Share Posted June 3, 2010 Because that's apparently where you're copying to/from. Check your code for a call to copy(). It's trying to copy from $_FILES["userfile"]["tmp_name"]. So it's the default temp directory. How do I allow this script to access this temp directory? Either stay within the paths specified in open_basedir, or turn it off. open_basedir is turned off. In the PHP.ini it's commented out. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/203690-open_basedir-restriction-error/#findComment-1067185 Share on other sites More sharing options...
Daniel0 Posted June 3, 2010 Share Posted June 3, 2010 Either stay within the paths specified in open_basedir, or turn it off. open_basedir is turned off. In the PHP.ini it's commented out. Apparently it isn't turned off if you are getting open_basedir restrictions. Configuration settings can be set a number of different places: http://dk.php.net/manual/en/configuration.changes.modes.php Quote Link to comment https://forums.phpfreaks.com/topic/203690-open_basedir-restriction-error/#findComment-1067214 Share on other sites More sharing options...
paulferree Posted June 3, 2010 Author Share Posted June 3, 2010 For every domain on the server when I run phpinfo I see the local value is set to that particular sites root path on the server, but the global value shows no value. So somewhere that value is being set for every domain, but I can't figure out where. I looked at the link you provided but I still couldn't find it. Any other ideas where to look? Quote Link to comment https://forums.phpfreaks.com/topic/203690-open_basedir-restriction-error/#findComment-1067219 Share on other sites More sharing options...
Daniel0 Posted June 3, 2010 Share Posted June 3, 2010 It's likely set in the vhost configuration for the domain names. Quote Link to comment https://forums.phpfreaks.com/topic/203690-open_basedir-restriction-error/#findComment-1067232 Share on other sites More sharing options...
paulferree Posted June 3, 2010 Author Share Posted June 3, 2010 Oh my, this sounds like a fun hunt. I don't even know where to start. hahaha. Quote Link to comment https://forums.phpfreaks.com/topic/203690-open_basedir-restriction-error/#findComment-1067255 Share on other sites More sharing options...
paulferree Posted June 10, 2010 Author Share Posted June 10, 2010 Ok, I've been running this around a bit. I'm wondering how I would just go about changing the TEMP (or TMP) directory where the form is temporarily uploading the file to fit within the boundaries of the open_basedir and avoid this altogether. And I'm sure it's the best security wise. I'm on a Windows Server btw. Paul Quote Link to comment https://forums.phpfreaks.com/topic/203690-open_basedir-restriction-error/#findComment-1070427 Share on other sites More sharing options...
Daniel0 Posted June 10, 2010 Share Posted June 10, 2010 Use move_uploaded_file; it's only restricted on the destination. Quote Link to comment https://forums.phpfreaks.com/topic/203690-open_basedir-restriction-error/#findComment-1070448 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.