Overview
This article explains what the /tmp directory is used for and how to create a custom /tmp directory for your website.
What is the /tmp directory?
Web servers have a directory named /tmp used to store temporary files. Many programs use this directory to write temporary data and generally remove it when it is no longer needed. Otherwise, the /tmp directory is cleared when the server restarts.
On shared servers, the /tmp directory is shared among all customers on the server. When it becomes full, some programs stop working. For example, it is no longer possible to upload a file to a site since there is no room in the /tmp folder to store the temporary file while it's uploading.
Creating a personal /tmp directory
You can configure your software to use any directory you want to maintain control of temporary file storage. For example, if your site is using PHP, adjust the upload_tmp_dir directive.
Where to create this directory?
It's recommended you create this directory in your user's home directory (outside the web-accessible directory). For example:
/home/username/tmp