开发者

Is it ok to rely on the writeability of /tmp folder?

开发者 https://www.devze.com 2023-01-20 04:47 出处:网络
Is it ok to assume /tmp folder writable by PHP/Apac开发者_开发知识库he on any unix system? I\'m making a script and want to save cache in the tmp folder and want to know whether that can cause proble

Is it ok to assume /tmp folder writable by PHP/Apac开发者_开发知识库he on any unix system? I'm making a script and want to save cache in the tmp folder and want to know whether that can cause problems.


It should be OK. /tmp is made for everyone to use. But be careful, it also means that anyone can read your files if you don't set specific permissions!

If you are unsure, make your installation script check the /tmp folder and make it possible for the user to configure another temp location. This is probably the best bet anyway because different users have different needs. Consider for example a user with load-balanced servers; she might want to use a folder which is shared between all her hosts.


You can not rely on /tmp folder as in some variations of linux, it is auto cleaned after some time, it would be best for your application to have a local tmp folder inside the app, which you manage yourself.

0

精彩评论

暂无评论...
验证码 换一张
取 消