• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

move_uploaded_file(): open_basedir restriction(NOT newbie problem)

C

crops

Guest
Hello,

i get the old error, move_uploaded_file(): open_basedir restriction in effect where on one of my domains i have done everything that is needed to ensure that my vhosts.conf file works correctly e.g.

<Directory /home/httpd/vhosts/DOMAIN/httpdocs>
php_admin_value open_basedir /home/httpd/vhosts/DOMAIN/httpdocs:/tmp:/usr/share/pear
php_admin_flag safe_mode 0
</Directory>

which is something thats created automatically with the creation of a domain with a shell script.

i've tried to edited again,manually and reconfigured apache again(with /usr/local/psa/admin/bin/websrvmng -u --vhost-name=DOMAIN) and restarted but no problem. My http.inlcude seems to be fine and has a reference to my .conf file


i have an .htaccess on the httpdocs directory that defines some directories dor inclusion and i have tried everything that is programmer possible to get a simple file upload to work ( ifeel stupid posting it here, but hope that someone has come accross smt similar)

The weird thing is that i have the FCK Editor that has a functionalitty to upload images and that doesnt have a problem at all.(i've tweacked it to create a thumbnail at the same time, which works fine) and I also used the umask option to get the permissions for the file fixed before moving it from the tmp folder to my folder, but nothing....

these settings worked for all my sites until now (they still work on other sites...)

does anyone has any suggestions?

much appreciated
 
You've probably checked these, but:

have you run a phpinfo(); to make sure that these open_basedir restrictions are actually being used.

Is the /tmp folder readable/writeable by PHP?

Hope you figure this out soon, because it sounds as though I might bump into it real soon. :(
 
done all these checks

Hi there,

yes checked out if this directory is W/R from php and there is no problem there. If it wasnt i would be able to upload images from my editor either which uploads files to that directory as well...

ive searched all forums but no one seems to have a similar problem... I know what i'm doing and i've expirienced these kind of errors before. Safe mode is off and the httpdoc directory is on the safe list.....
 
SOLUTION

Hi again,

so basically i knew that it was something stupid. To share my finding with others, as far as it concerns the open_base_dir restriction EVEN when you have done what the others have posted (eg. vhost.conf file and reconfiguration plus restarting the apache) you need to remember that whatever you do your script will have to refer to the file with a relative path from the file executing the function

for e.g. i was trying to use the move_uploaded_file method and i was giving the bew file the directory path eg. /httpdocs/photos/file.jpg which will give you that error even if do have all the settings correct (I'm usre you understand why..). so basically if gave the script a relative path e.g. ../photos/ (realtive to the script ) then no problem...

hope that info helps someone
 
Back
Top