Help needed: is_dir() [function.is-dir]: open_basedir restriction in effect.

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
BastouBach's picture

Hello,
I am still new-ish to Drupal.

I recently moved my site from local machine to a test online site. When I try to create content, I get this:

warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/Applications/MAMP/tmp/php) is not within the allowed path(s): (/var/www/vhosts/ermep.com/subdomains/test/httpdocs:/tmp) in /var/www/vhosts/ermep.com/subdomains/test/httpdocs/includes/file.inc on line 102.

I created the directory /var/www/vhosts/ermep.com/subdomains/test/httpdocs:/tmp/php and understand that I need to replace the old /Applications/MAMP/tmp/php with this new one. I tried to do that in the file systems (admin/settings/file-system) but it tells me The directory /var/www/vhosts/ermep.com/subdomains/test/httpdocs:/tmp/php does not exist. I cleared the cache, I opened the file.inc file and went to line 102, but it does not seem to be there either...

Can anybody help?

Thanks,

Sebastien.

Comments

Go to the admin panel and

drupalprojects's picture

Go to the admin panel and edit filesystem settings.
I suggest you to put tmp folder inside files folder.

I frequently run into the

admixarts's picture

I frequently run into the same sort of errors with the "/tmp" directory/file system when building Drupal sites. What I found is that there seems to be some confusion happening between who owns the /tmp directory (i'm talking about directory permissions). I'm mostly a designer not a full fledged developer so I appologize if I get the dev handshake talk screwed up. What I think is going on here is: If you let Drupal create your /tmp directory by using your File System settings in the admin area, it then assigns or attempts to assign the permissions to that directory. Those permissions seem to work very differently than if you were to create the /tmp directory on your own with an FTP client.

What I usually do to fix my /tmp directory problems is: Delete the auto generated /tmp dir using my FTP client or file manager from within Cpanel or other hosting control panel software. Then I just re-create a new directory, give it the same name as the one we deleted (/tmp), make sure it's properly writable and I'm off to the races. Well most of the time.

The file system in Drupal can act quite finicky at times in certain server environments. I found some servers I never have the issue on others happen on almost every site.

I'll start documenting this issue some more the next time it surfaces for me.

Another thing you can double

admixarts's picture

Another thing you can double check is your .htaccess file settings.

If your root install is located in a sub directory you should modify the RewriteBase rule by un-commenting line #103 (in my file) (rule looks like: # RewriteBase /). Then add the path to your install directory like: RewriteBase /subdir-or-virtual-root/drupal-install-dir

no joy

staff_whyte's picture

I tried both these and did not work.
I dont have a tmp folder in my sites/default/files folder either, I created one and still no joy...any ideas?
I am getting this after migrating from one host to another. The site is in a subdomain, I updated the .thaccess to rewritebase for /subdomain

fixed

staff_whyte's picture

I updated the folder permissions to 777,also had wrong path to my tmp folder,contacted my hosting provider and got correct path.

folder permissions should never be 777!

triple5's picture

don't do that.
777 means world writable, most likely you don't even want to have them world readable, let alone writable,
look at http://drupal.org/node/244924 for some detailed settings.

Open Basedir restrictions does not care about your file settings, when the path is not within allowed paths, you are just not allowing the file to be accessed, this is a setting in apache that may be overridden by the .htaccess file.

dotnhack's picture

ning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/var/www/vhosts/vamarion.com/httpdocs/sites/all/files) is not within the allowed path(s): (/var/www/vhosts/mxel.net/httpdocs:/tmp) in file_directory_temp() (line 2354 of /var/www/vhosts/mxel.net/httpdocs/includes/file.inc).

I can't upload any images using field_image... I have tried all I know with permissions chmod/chown/chgrp etc. but no joy :(

It is a dedicated server at Godaddy

looking at paths

triple5's picture

dotnhack: you have two different things set up, first you have a domain mxel.net and open basedir for that user does not allow the user vamarion.com to access the files. Did you set this up with ISPConfig or Plesk or something like that? It doesn't matter whatever you did, you probably have to set the path under
vamarion.com/admin/config/media/file-system
(in Drupal 7)
the directory should be owned by your user and the group be accessible to the server /for example www-data or in ISPconfig: client* and must probably be like this:
/var/www/vhosts/mxel.net/httpdocs/sites/all/files/tmp
it is not recommended to have the tmp dir readable by everybody!
file settings should be more like 770 than 777!
see also http://drupal.org/node/244924 for file permissions