Move_uploaded_file() not working?

software development

#1

Hey guys,
Just wondering if you are also experiencing this problem. I’m trying to move an uploaded file to a directory within my home directory but its giving me this error regardless of what I do:

Warning: move_uploaded_file(): open_basedir restriction in effect. File(/home/chiisana/data/EDEACF00/9ECBD0C8/clientaccess.txt) is not within the allowed path(s): (/dh/web/phpmyadmin:/tmp:/usr/local/tmp:/dh/solidclient:/usr/local/lib/php:/home/chiisana:/home/.esso/chiisana) in /home/.esso/chiisana/tppas.chiisana.net/newuploads.php on line 45

It’s really annoying because I need to accept one or more files from the user upload, but the system will not move it so I cannot keep the files that the user uploaded, at all.

Does any one know of a workable solution to the above problem?

Regds,
Andy Huang


#2

Back when Dreamhost used to require you to run php as a cgi by renaming files .pcgi I could only get file upload working if I renamed my script .pcgi to make it use the CGI version of PHP and not mod_php built into the webserver

Since then they’ve changed it to an option in the web panel.

So the practical upshot is: Are you running php as a CGI? and if not, try that.


#3

I intentionally turned it away from cgi when I created that domain because DH’s php cgi = massive memory wh*re and causes problems (supposively bugged) when using fopen buffered fread to deliver the file uploaded (IE: if file is over 50mb, expect ~50 load average until the file is fully transfered). Guess I’ll have to set it back to cgi mode to give it a test…

I’ve made the change to cgi mode now, will need a few minutes before it kick in I think… Will post back with updates.

Edit:
Test result, fail. Still same error.

Edit (again):
Sorry, jumped the gun and hit refresh when I noticed the clock on the domains list went away. Confirmed that it is a mod_php bug on DH. PHP cgi works no problem for this part…


#4

Just experienced this myself, thanks to Google and your postings I was able to solve the problem (also had cgi specifically disabled to try and prevent overhead, but we’ll see what happens… might need to bone up on PHP5 and see if there are any new ways to move files around that I’m not aware of).

Thanks again - Tony R.