When trying to upload a logo to my Zen 3.1 subtheme (Appearance > Settings) I get the following error:

Warning: is_file(): open_basedir restriction in effect. File(/tmp/phpillr69) is not within the allowed path(s): (/home/testwww/web/) in image_get_info() (line 126 of /home/testwww/web/informator/includes/image.inc). 
Warning: realpath(): open_basedir restriction in effect. File(/tmp/phpillr69) is not within the allowed path(s): (/home/testwww/web/) in drupal_realpath() (line 2177 of /home/testwww/web/informator/includes/file.inc). 
Warning: getimagesize(): Filename cannot be empty in image_gd_get_info() (line 349 of /home/testwww/web/informator/modules/system/image.gd.inc). 
The specified file logo.gif could not be uploaded. Only JPEG, PNG and GIF images are allowed.  

It happens even though I have the paths in Configuration > Media > File System set to be inside the web root.

  • Public file system path: sites/[my directory]/files [permission 775]
  • Temporary directory: sites/[my directory]/files/tmp [permission 755]

It seems that Drupal tries to save a temporary file in /tmp/ although the temporary directory is set to something different.

How can I fix the problem to be able to upload a file?

  • what exactly are the path you set via the drupal UI (admin/settings/file-system)?
    – nonsenz
    Jun 11, 2011 at 10:04
  • sites/[my domain]/files and sites/[my domain]/files/tmp Jun 11, 2011 at 19:43

2 Answers 2


The key here is that PHP is attempting to create the temporary file in a public directory. If you refer to the your PHP settings, find out what is specified for the 'upload_tmp_dir'. Use a phpinfo() call to display this, also available in the Status Report by clicking on the PHP version number. This directory has special privileges that open_basedir will not block. Set your drupal temp directory to this path explicitly and it should work.

  • Thanks codexmas. I've come up with the solution shortly before Your post. :) I had to set PHP upload_tmp_dir variable to a directory whithin open_basedir allowed path. The issue resulted from PHP's upload_tmp_dir. upload_tmp_dir is a temporary directory used during file uploads. By default it was /tmp which is outside open_basedir allowed path. Thus, the problem appeared. My open_basedir allowed for operations within /home/testwww, so setting upload_tmp_dir to /home/testwww/web/tmp solved the issue. :) Jun 24, 2011 at 12:49

Sometimes it's caused by eaccelerator. Just remove it from PHP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.