The default specification of "/tmp" at
"Configuration" > "Media: File system": "Temporary directory"
can cause errors with manual webhost installations of Drupal 7.


Sample Errors:


With module "Update manager" enabled:

Warning: unlink(/var/tmp/update-cache/skinr-7.x-2.x-dev.tar.gz) [function.unlink]: Permission denied in drupal_unlink() (line 2139 of /home1/greatgr2/public_html/a-a-a-a/includes/
Warning: rmdir(/var/tmp/update-extraction/skinr/tests/skins/example) [function.rmdir]: Permission denied in drupal_rmdir() (line 2277 of /home1/greatgr2/public_html/a-a-a-a/includes/


When trying to "Install from a URL"; even with the "Update manager" UN-enabled:

Warning: mkdir() [function.mkdir]: Permission denied in drupal_mkdir() (line 2244 of /home1/greatgr2/public_html/0000/g/includes/
The directory /tmp-test-del-hi_blue_host_tech does not exist and could not be created.


The solution is to rename "/tmp" and "Save configuration"
and see whether or not you immediately get errors.


/tmp2 (this location did not work for me, but the following all did)

If you recieve no errors upon clicking the "Save configuration" button
then your troubles are over. If so, try another name.

I highly recommed leaving the beginning slash "/"
in front of whatever name you choose so that
the temporary files directory location will be created
at a level two parents higher than your online public_html directory.

If you do fail to use the slash at the beginning,
the directory will be created inside of your D7 root folders
as in using "tmp" will result in the creation of
public_html/[d7-root]/tmp and at that location files will accumulate
and require you to delete them manually if you want to get rid of them
and they serve no purpose
except to use up disc space uneccessrily.


Note: Re: A SimpleScripts' installation default "Temporary Directory" location:
..and at this location files accumulate and require manual deletion.


Do not use "~" as "Temporary Directory" location:

My original recommendation of simply adding
a "~" character in front of D7's default of "/tmp"
in the field-box "Temporary directory"
at "Configuration" > "Media: File system"
causes D7 to create your temporary D7 folder
in your site's folders
at [d7-root]/~/

Additionally, and more importantly,
if you try to delete those unwanted files
using an FTP program,
you may, like me, find that trying
to navigate into ANY folder named "~"
on your wbhost site using FTP,
causes you to be immediately taken
to your website's root folder—
which is to say that you can not access those
temporary files using FTP to delete them.
and you will have to delete the temporary files
via your webhost's Control Panel (CPanel).


My notes:

- This problem only occured at one of my two different
accounts although they differ only in domain name (both are basic $6.95/mon.)

- I gave midnight tech at bluehost access to my D7 "Reports" page
and asked if he could tell me what difference
he might see between my two host accounts
but he could not easily establish why one site would have had problems
while the other one did not.

- While testing possible "Temporary directory" choices,
"/tmp" did finally get accepted and I am using it now error free
including that I get no errors immediately post-installation
when I leave 'Check for updates Automatically' enabled during install.

- The successful acceptance of "/tmp" happened at a time just few seconds
after I noticed the my FTP program had just hung.


Christopher James Francis Rodgers’s picture

Status: Closed (duplicate) » Active
Issue tags: -tmp file, -permission denied tmp

2011.06.06 - Ignore the above; I can Not edit the post above.


All you really need to do if you are having problems is to remove the forward-slash ("/") from "/tmp"
and specify 


only at --> [Your-D7-root-home] » Administration » Configuration » Media: File system » Temporary directory.

Please see Comment #11 below for additional details

[Although an additional alternative to comment #11 is for you to
install Drupal 7 via your WebHost's "SimpleScripts"
or other automated-script-installation free service. See
"Install Drupal 7 in one-minute (or Drupal 6)" Tutorial.]
2011.06.06 DELETED erroneous suggestions

onewomanbiz’s picture

Issue tags: +tmp file

I'm having this issue at install of Drupal 7.

•Warning: unlink(/tmp/update-cache/ [function.unlink]: Permission denied in drupal_unlink() (line 2141 of /home/charl145/public_html/onewomanbiz/includes/
•Warning: unlink(/tmp/update-cache/ [function.unlink]: Permission denied in drupal_unlink() (line 2141 of /home/charl145/public_html/onewomanbiz/includes/
•Warning: unlink(/tmp/update-cache/ [function.unlink]: Permission denied in drupal_unlink() (line 2141 of /home/charl145/public_html/onewomanbiz/includes/
•Warning: unlink(/tmp/update-cache/ [function.unlink]: Permission denied in drupal_unlink() (line 2141 of /home/charl145/public_html/onewomanbiz/includes/

...etc creates an unterminable scrolling page and then congratulates me on successful installation of Drupal 7. Huh??? What the ???
Anyway, I tried to change /tmp to /tmp2 in but it doesnt change anything.

Are there more places/ files I need to change the name of the tmp file?

I would really like to get past installation...the famous Drupal 7 one minute installation mentioned somewhere here, seems rather utopic at this point.

onewomanbiz’s picture

Issue tags: +permission denied tmp

Found it inside drupal 7 admin control panel in configuration. changed to tmp/temp sucessfully.
Hope this is useful to others.

bfroehle’s picture

Status: Active » Closed (duplicate)
Christopher James Francis Rodgers’s picture

Title: D7 Manual Webhost Install Errors from "/tmp" - the default "Temporary directory" in "Media: Filesystem" - Solution. » Webhost Install Errors from "/tmp" - the default "Temporary directory" in "Media: Filesystem" - Solution.

Re: One-Minute Drupal Install.
If your webhost provides "SimpleScripts"
(As most major commercial WebHosts do)..
Then you can install either Drupal 6 or Drupal 7
in 41 seconds. I did,
and all I know how to do is use a keyboard, mouse, and
"Copy" / "Paste".
The route to auto-install D7 or D6 in one-minute is..
Webhost > Control Panel (CPanel) > Simple Scripts > Drupal > 7 (or 6).
"Follow your nose: It always knows."
My "Rough Draft" tutorial to a one-minute-or-less
D6 or D7 install is at..
If you are seeking an online webhost for your site,
that you can be sure is "Drupal friendly", go to (Yes that site is affiliated with this site)
and click on one of the webhosting provider links there
and you will be helping to support the Drupal cause
as well as your getting a webhost for less than $4 USD per month.

Christopher James Francis Rodgers’s picture

Title: Webhost Install Errors from "/tmp" - the default "Temporary directory" in "Media: Filesystem" - Solution. » D7 Manual Webhost Install Errors from "/tmp" - the default "Temporary directory" in "Media: Filesystem" - Solution.
onewomanbiz’s picture

Okay, maybe I'll try installing D7 through automated hosting scripts. Thanks for the tip.

Christopher James Francis Rodgers’s picture

That tip, my friend, is my pleasure.

I was shocked the other day to see that
SimpleScripts was D7 ready.

Given my concern for New Users,
I am now thee happiest boy on Earth.

- Chris.

### I know it should be ".. the happiest .. "; but that pales.

pete_l’s picture

My D7 instance is hosted on a commercial site. I don't have access to the filesystem above $HOME. To be clear, I can't put stuff in /tmp.
I found that setting my Home » Administration » Configuration » Media Temporary directory to "tmp" without the slash AND setting that directory's permissions to 0777 allowed me to install modules from their URL.

That's all I needed to do

cisliu’s picture

I met the same problem, tried different route, such as changing "/tmp" to "/tmp2 or /tmp3", etc. None worked!

Finally, it was the post by pete_I on May 3, 2011 saved my life. Thanks a lot!

Christopher James Francis Rodgers’s picture

All you really need to do if you are having problems is to remove the forward-slash ("/") from "/tmp"
and specify 


only at --> [Your-D7-root-home] » Administration » Configuration » Media: File system » Temporary directory.

My conclusion is that 'when' these errors and problems occur
they are always on Drupal 7 online manual installations at commercial webhosts
and are a result of the forward slash ( "/") being the first character in the default
[Your-D7-root-home] » Administration » Configuration » Media: File system » Temporary directory
field-box. ... the default text in that field-box being /tmp.

(Strangely; the problem was limited to only one of my
two identical-type-of-accounts at the same webhost;
and the problem mysteriously went away one day.)

My understanding is that using the forward-slash as the first character
in that field-box was causing D7 to try to use a folder (directory) two levels higher
than my public_html folder (directory) at my commercial webhost
and that that was the source of the conflict.

This was only a problem with manual installs of D7 and was Not a problem
when I installed D7 using my webhost's free CPanel SimpleScripts tool
that automates the entire D7 installation. (Most Webhosts provide this free service)

All you really need to do if you are having problems is to remove the forward-slash ("/")
and specify tmp only; and when you click the button
"Save configuration", Drupal 7 will create a folder at [Your-D7-root-home]/tmp
and will use that location without any further problems;
and you should Not need to adjust any permission levels (0777, etc.)
on that folder: Per my understanding and experience.

I was wrong earlier to think that files would accumulate in that folder
(which is why I had originally been recommending that
you try different names starting with the "/").
All that ever accumulates in my "[root]/tmp" folder
is an occasional empty folder or two.


All the best.

digilu’s picture

Title: Webhost Install Errors from "/tmp" - the default "Temporary directory" in "Media: Filesystem" - Solution. » D7 Manual Webhost Install Errors from "/tmp" - the default "Temporary directory" in "Media: Filesystem" - Solution.
Status: Active » Closed (duplicate)
Issue tags: +tmp file, +permission denied tmp

Thank you so much for this post.

Perfect solution.

Ludwig’s picture

Thanks! That stopped me going round and round:-)
Much appreciated.

ErgunK’s picture

I got this error when i wanted to update Drupal database(after downloading new versions of some modules):

"...could not be saved to temporary://update-cache-1afc1ece..."

Going to Administration » Configuration » Media: File system and clicking "Save configuration" button solved my problem(without any changes).

garryh’s picture

Yours and other posts here are helpful. Thanks. However D7 recommends that the tmp directory is not public.

I've done a manual install of D7, so by removing the leading slash, my tmp directory would reside in the same location as core files and the sites directory [public_html]. Does this really pose a risk, and why?


jisuo’s picture

I'm having these errors on Drupal 7.12 after enabling and then disabling the css/js aggregation. I tried removing the forward slash so it was tmp but it didn't help. Not sure what to do more.

error finally went away when I did chmod 777 sites/default/files -R. I had chmoded all the folders I suspected before this.

jimboh’s picture

I thought I should follow the requirement

This directory should not be accessible over the web.

Merely clicking save as in #14 did not work for me. I set the value to /tmp/drupaltmp and it worked fine.
btw this has only happened to me on 2 of 14 D7 installs and both were using hosts quickinstall script, never happened on a manual install.

sgtsaughter’s picture

#16's EDIT worked for me when removing the '/' in /temp didnt work.

krazykellie’s picture

Hey All,

I've tried changing the /tmp to tmp and creating a new tmp2 folder to see if that works. But nothing seems to help.

I also changed all of the permissions of the folders and the folders leading up to it to see if that helps.

I'm at a loss.

Any help is appreciated.

jayhawkfan75’s picture

I've tried #11, but I still received hundreds of errors upon updating from 7.14 to 7.15 like this one:

Warning: unlink(C:\inetpub\wwwroot\sites\default\files\css\css_-abcdefg.css): Permission denied in drupal_unlink() (line 2199 of C:\inetpub\wwwroot\includes\

I downloaded that update and installed it manually, but still received those errors.

I also periodically receive these errors when performing regular tasks within Drupal 7, but not all of the time. Is this a bug that the core maintainers are working on, because a solution of making a tmp directory completely writable by all users seems like a scary idea security-wise.

jimboh’s picture

On a D7.15 install i just did using my hosts quickinstall script I had a problem with updates being able to save temporary files to /tmp. I found it was attempting to save to the root /tmp , ie above my shared hosting accounts top dir which was /home/myacct. I set the temp file directory to /home/myacct/tmp and it works fine.

jayhawkfan75’s picture

Thanks for the reply.

My tmp directory is not in the root on my server, but it is at the same level as all of the other Drupal directories (i.e. sites, includes, profiles, themes, etc.). Isn't this the way that I'm supposed to have it set up? Everything that I've read so far says not to put it into one of those directories, so if I'm mistaken, I'd appreciate some direction. If that is the case, where else should it be placed? Thanks.

jimboh’s picture

It should be above the drupal directory.

In order not to be visible on the web it needs to be above the directory your host provides for your website (html etc) files. On my host, when I use file manager in cpanel or ftp, within my root directory I have a public_html folder (sometimes called www or html). My tmp directory is at the same level as the public_html directory and drupal is installed inside the public_html directory.

With my host (hostgator) the root / directory I see in ftp is actually /home/myacct (where myacct is the account name given to me by my host) , so my tmp directory is at /home/myacct/tmp, my sites directory (and other drupal dirs) is at /home/myacct/public_html/sites.

(if I had installed drupal in a sub dir then tmp would still be at /home/myacct/tmp but sites would be at /home/myacct/public_html/drupalsubdir/sites)

If I put /tmp as the temp file location I believe it is trying to write to a directory that is outside of my shared hosting space (2 directory levels up), so it would fail. That at least is what I think is happening.. perhaps someone will correct me if I am wrong.

jayhawkfan75’s picture

@jimboh: I placed a tmp directory at the same level as my Drupal site's root per your suggestion, and I now get these errors:

Warning: mkdir(): Permission denied in drupal_mkdir() (line 2338 of C:\inetpub\wwwroot\drupal\includes\
The directory tmp does not exist and could not be created.

This is my setup:

Tmp directory: MYSERVER\tmp
Drupal site: MYSERVER\drupal
Sites directory: MYSERVER\drupal\sites

Is this what you were suggesting? If so, it did not work for me, and I'm still getting hundreds of Warning: unlink errors still whenever I update stuff (i.e. clear cache).

I also tried putting it at MYSERVER\drupal\tmp, but that also resulted in the multiple Warning: unlink errors.

jimboh’s picture

I believe that is still not correct because the tmp directory is still viewable on the web as its at the same level as drupal (I said it should be above). Normally you would have directories higher than you are showing. Is MYSERVER really the root of your server acct? I have directories above that such as etc, public_ftp, mail etc. The tmp should be at that level I believe.
However, from your error, drupal is not seeing the tmp directory you have created so I suggest maybe the place where you told drupal your tmp was is not the same as where you have actually placed it.

What did you enter as the location of your temp directory at /admin/config/media/file-system?

I am sorry I dont believe I have ever seen the unlink message so I cant say if that is an related or unrelated issue.

As an aside:
I moved one of my clients sites from the host it was on to my regular host because I had huge problems with permissions with drupal. I cant remember the exact reasons but i believe it was that drupal processes did not have access to all areas as it would have if it was installed by the account admin/owner (it was already installed when I took on the client).
I ended up having to have directories (eg sites/files etc) set at 777 (obviously not correct) just so drupal would stop throwing errors when trying to write to them. The host support site was unable to sort it so I moved it and it worked great at the new host just by copying it over.

jayhawkfan75’s picture

That server's setup is like this: \\MYSERVER\wwwroot\drupal

Everything for my site lives off of the wwwroot directory.

...and I have the tmp directory here: \\MYSERVER\wwwroot\tmp

...which is not within the "drupal" directory at all. Putting the tmp file at \\MYSERVER\tmp would be an improper thing to do for us and most anyone, especially if giving writes access to that directory.

I did try giving full write access to the directory, but it didn't work. I also tried several other suggestions listed at without success. I listed the outcomes of each of them at

Honestly, I think that the entire setup of the tmp directory is fuzzy, because you shouldn't have to give full write access to regular users on a directory like that. Also, depending on where you go on this site, where the location of the tmp directory should be is up for grabs it seems, which isn't a very secure feeling for a newbie like me.

This install of my site is for an intranet site, so I have to manually do things like module updates by downloading them first. But I just don't get how something this simple doesn't work properly even after following Drupal's instructions on it.

jimboh’s picture

The way I understand it is that everything from wwwroot and below is readable from the web in theory so the tmp should be above that, ie at \\MYSERVER\tmp. It is not writable by anybody because there should, by default, be no access to that directory from the web. However programs and scripts (drupal included) can write to it. If you allow directory level access to your site and then visit the url direct eg, you will normally see the directory structure at the wwwroot level (if i am not mistaken), there is no way to navigate higher!

Incidentally, on both my shared and dedicated servers my tmp dir in this location is permission 755 so writeable by "owner" only and the tmp dir and the drupal installed files all have the same owner (and group).

Drupal 7 defaults to /tmp which if your real root was at myserver would be fine, but on my servers at least , /tmp is a directory higher than myserver so it needs to be /home/myserver/tmp.

I am not sure why sometimes setting it to /tmp/mytemp for example seems to work.

Of course just because i have convinced myself that this is all true, doesen't mean that it is!!!

jayhawkfan75’s picture

I tried to create a tmp directory in that location, but didn't have access to do so. I think that's because with our site's structure, everything site-related needs to be in wwwroot. I've always believed that was standard practice.

Also, every time that I put the tmp file in a location and then reference that location from within Drupal, I receive a message that the folder can be accessed but is not writable. Even if for testing purposes when I set that directory to be completely writable by everyone, I received a confirmation message from Drupal's Configuration » Media » File system section.

I can see this is the case because Drupal then automatically creates a matching .htaccess file for the tmp directory that I've referenced. However, I still receive those annoying errors when doing regular maintenance tasks (i.e. clear cache, update, etc.).

I'm placing this comment into the other related issue report ( as well.

jimboh’s picture

Sorry it hasn't fixed it for you. Its pretty standard to have the tmp dir above the wwwroot. The other programs provided by my hosts eg webalizer, awstats etc all use it for temp files, putting them out of reach of the web.
Your problem sounds a little bit like the one I had with the host I left, whereby the drupal processes did not have access to areas even when permissions were set so they should (although I think it worked with 777's everywhere (a def nono). I spent weeks going round in circles and as I said switched hosts and everything worked as it should straight off. So my guess is your problem is with your server config and not with drupal.
Do you have access to another server you could copy your site to and test?

jayhawkfan75’s picture

That's an interesting thought, and possible, since my site is located on an internal server. What's strange though is that Drupal's been able to do other things to that tmp directory except for this unlink function.

For instance, I see the following files in there:



I can see from the documentation that when I originally set up the tmp directory, the .htaccess file's supposed to be automatically created, which it is. So I don't understand why Drupal would then have an issue in performing a function against that same directory.

I'll give your suggestion a try on another external server to see if it works in that case, but I thought that Drupal was supposed to work properly whether it's installed locally, on an intranet, or on the web. That's why I'm at a loss at this point. This would seem to be something simple to solve.


I thought more about it, and remembered that these errors started appearing when I updated Drupal from 7.13 to 7.15 (and eventually 7.15). Each time I updated it, the "sites/default/files? directory would give me an error about it not being writable. Each time, I'd have to make that directory writable again.

So I again placed the tmp directory within the files directory, went directly onto the server using IIS 7 Manager, and added write permissions for IIS users only. The errors still appeared, so then I added write permissions for all users of that server. That solved the problem.

Now the problem I have is that I don't want to have full write access for *all* users of the server, right? That seems very insecure. Do you (or anyone else) know if this is how Drupal intended it to be with a regular install, regardless of the server-type?

Duarte Cancela’s picture

I have this problem on my Drupal 7 too and i don't know what to do more!? i tried everything;

change /tmp to tmp

Change tmp folder to permissions 777

Use another tmp folder as the tmp folder on the Drupal root

nothing work... no ideas :(


Christopher James Francis Rodgers’s picture


Assuming you are seeing the snippet as an error,...

"Warning: unlink(/var/tmp/update-cache"

...I will say that I searched for that phrase at Google
about a year ago,
and I posted in every page that Google showed,
and this issue has been very rarely addressed since.

So, if you are seeing an error with the snippet,
"Warning: unlink(/var/tmp/update-cache"...
at its beginning then I wonder:

- Is this a new installation of yours,
or did the problem start up
when you installed a new module?
If so, try to un-"Enabled" your non-core modules.

- Are you using a new account at a new webhost
(I assume your problem is from an on-line installation of Drupal 7
as opposed to a "local" on your desktop installation.)
A phone call to them might be a painless and fruitful experience.
(And although that would make me happy,
it would also surprise me. :o)

- I believe the problem had always been associated
with a 'manual' installation at an on-line webhost
as opposed to a automated-script installation
through the webhost control panel (cpanel);
and if so, you might be able to "Import" your manual installation
using the automated script service. I can do this since my webhost
has 'SimpleScripts' as their automated Drupal one-click installer /
Drupal site importer.

I am only an end-user / not a programer,
but if you could give more details,
others might have a clue for you.

- Chris

Christopher James Francis Rodgers’s picture

If you feel like reading,
these related page
might have additional clues:

(as noted in post #28 above)

Google search: "Warning: unlink(/var/tmp/update-cache""Warning%3A+unlink(%2Fvar%2Ftmp%2Fupdate-cache"

Duarte Cancela’s picture

I think i solved the problem i instaled a zip version of module instead of tar.gz i don't now why tar.gz doesnt work!? what could be happened?

Christopher James Francis Rodgers’s picture


I wonder what module you are referring to, though.

I thought you were having problems just using Drupal 7 core.

I have never had any problems installing *.tar.gz module files on the
"Add new module" page
in thee "Install from a URL" field-box.


mamanerd’s picture


I ended up making the default Apache web user (for Ubuntu) the owner of the files folder:
sudo chown -R www-data /var/www/sites/default/files

And then changed the permissions on the folder and everything inside it to 744:
sudo chmod 744 /var/www/sites/default/files -R

Works fine. :)

jimboh’s picture

EDIT: Comment on previous post retracted. Sorry, I don't know if you edited your post but obviously 744 is not writable by anyone but owner so that is not a security issue.

jawad.shah’s picture

ref #11 is perfect solution.

Thanks Christopher James


natuk’s picture

In my case the problem was that my host had disabled the php copy() function for security reasons. Enabling that in php.ini fixed the problem.

Omkar Suvarnkar’s picture

Thanks, It worked