jreed2132 Posted March 3, 2010 Share Posted March 3, 2010 I'm on a Suse Linux box running Apache and using PHP to upload a file to the server. I use this same script on our test server and it works fine, but on the production we have our websites stored on a SAN so the files aren't directly stored on the server. But the problem seems to be happening at this line of code move_uploaded_file($tempPath, $filepath) or die("Error while moving temporary file to target path: " . $relativePath); Its when the uploaded file is moved from the temp location to the official location. My real question here is, I have to use "sudo" before any commands to the file locations on the SAN. Do you think I would need to use SUDO somewhere in the script? If so, where?? Quote Link to comment https://forums.phpfreaks.com/topic/193993-having-problem-moving-uploaded-file/ Share on other sites More sharing options...
l0ve2hat3 Posted March 4, 2010 Share Posted March 4, 2010 make sure php has permission to the directory... chmod it to 777 and if it works you know thats your issue Quote Link to comment https://forums.phpfreaks.com/topic/193993-having-problem-moving-uploaded-file/#findComment-1021222 Share on other sites More sharing options...
tallship Posted March 4, 2010 Share Posted March 4, 2010 No. You shouldn't be sudo'ing in a script. This may be an suexec issue or your uid may not have the appropriate permissions to write to the network store on the SAN. 777 may work, but it's kinda crazy, although many people do it just so they don't have to deal with worrying about it. check some of the files on the SAN repositories with $ ls -la to determine what permissions are typically placed on the files, as well as who owns them. In the general sense, it should be the user that Apache runs under that has the problem of meeting the security requirements to access the network store. There are often kludges that you can use in a heterogeneous environment if you're having problems with things like ACLs, such as what people are having lots of problems with on Mac systems. For example, the chmod for the new Macs includes a '-N' option - a kludge to disable ACLs which have been causing problems. wrt 777, well, you can't do that on my servers, as many people have found out. All of my servers are configured to provide an error for having such a complete disregard for security. Again, separate yourself from the the user performing the action in your scripts - it isn't you. Check to see who httpd is running as, and I suspect that's where your problem is. Quote Link to comment https://forums.phpfreaks.com/topic/193993-having-problem-moving-uploaded-file/#findComment-1021410 Share on other sites More sharing options...
jreed2132 Posted June 4, 2010 Author Share Posted June 4, 2010 The user was granted the wrong permissions. Thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/193993-having-problem-moving-uploaded-file/#findComment-1067666 Share on other sites More sharing options...
tallship Posted June 4, 2010 Share Posted June 4, 2010 Glad to hear it! I figured this was where the problem was, and nice to know it has been resolved Quote Link to comment https://forums.phpfreaks.com/topic/193993-having-problem-moving-uploaded-file/#findComment-1067814 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.