Solve the /tmp Limitation on VPS

Okay, so ever since switching to VPS I never realised that /tmp was limited to only 128mb, I guess I just assumed it would scale with VPS size and/or page out to disk if it needed to, but no, it has a hard limit of 128mb. This was a problem, as somehow my /tmp folder had filled up with files from the dhapache user, which didn’t leave any remaining space for anything else.

This is a problem because the default file upload location for PHP is under /tmp, so once it filled up, file uploads on my phpBB forums started failing with 500 Internal Server Errors.

The solution to this has been to create a separate folder under $HOME/tmp and reconfiguring PHP to use this for file uploads; this isn’t a big deal really since file uploads are going to end up on the same file system anyway, so its probably better overall in practice.

But this doesn’t solve the problem for other users who (like me) don’t know about the /tmp limitation, and suddenly encounter issues.

So I think this is something that really needs to be tweaked to solve the problem. As I understand it tmpfs file systems can be allowed to simply use excess RAM before paging to disk, so I’m not sure why there should be a need for a 128mb limit, except to prevent file leakage from services that never clear them; however this seems like something a cleanup script should easily be able to control, and like I say, the only files I’ve noticed eating up the space all came from dhapache :stuck_out_tongue:

The alternative would be to configure another /tmp folder like I did, with a default cron job to keep it clean, and to change the default PHP configuration (and anything else) to use this location in place of /tmp.

+1 - This needs to be resolved.