Hello,

I have a fresh Drupal 6.6 installation with CCK and ImageField(6.x-3.0-alpha2) module.
After I created a new content type with an Image filed seems that every time I try to upload an image for this field I get this error:

“warning: is_file() [function.is-file]: open_basedir restriction in effect. File(/var/tmp/phpzvwrkY) is not within the allowed path(s): (/usr/local/www/vhosts/verticalwavesolutions.com/subdomains/dev/httpdocs:/tmp) in /usr/local/www/vhosts/verticalwavesolutions.com/subdomains/dev/httpdocs/includes/image.inc on line 117.

I checked all the permissions for the File system path and Temporary directory and they all look fine. They have writing permissions and so on.

Could anyone tell what this error is related to ? I can't find anything about this on Google.
Seems that the same setup with Drupal 5 works fine.

Thanks!
Alex.

Comments

andb’s picture

Check your Apache virtualhost settings. If you see a line in /etc/apache2/sites-available/default (Debian, maybe other location if you have different distro or windows) that looks like:

php_admin_value open_basedir /var/www:/tmp:/usr/share/php (yours may be slightly different)

Then this is the cause. This line prevents the Apache webserver from accessing any files outside of these directories, which is a good thing for security. If you have such a line, you should check the settings for your file system (SITENAME/admin/settings/file-system) and make sure that you are not writing outside of the restricted path. The default is 'sites/default/files' (note, no leading slash!) and should only be changed if you have a really important reason. The temp dir usually ought to be '/tmp' but if your host is limiting you to your webroot, then change this value to '/tmp/'. Drupal ought to make the dir for you, but if it doesnt, just go ahead and make a directory in the web root called 'tmp' with user - write permissions, and make sure its globally readable and executable, but not writable.

mass5’s picture

Thanks for the advice.
What I did is I've created a new vhost.conf file in the conf directory of my subdomain and I've set the php_admin_value open_basedir to none.
That solved the problem, but I'm not sure this is the best solution.

quicksketch’s picture

Title: can't upload image » Can't upload image
Category: bug » support
Priority: Critical » Normal
Status: Active » Closed (fixed)