# ls /var/lib/php5 | wc -l

# ls -la
-rw-------  1 wwwrun www       0 Nov  9 15:30 sess_vtuh671rlafdidfjmgjfu6065p4tfieg
-rw-------  1 wwwrun www       0 Nov 12 02:30 sess_vu9pn476oiqbsd20q4s2brt60b9vg90d
-rw-------  1 wwwrun www       0 Nov  9 15:07 sess_vuonfs2cqsdiq8ja51ornh6lp5j9mf93
-rw-------  1 wwwrun www       0 Nov  9 16:02 sess_vuutcad8as55il34db3uqhqrsltd4q6o
-rw-------  1 wwwrun www       0 Nov  9 23:26 sess_vv2mrv5dnlnts6das4g5jlfldael4l0e
-rw-------  1 wwwrun www      44 Nov  9 20:35 sess_vvc0cfjuvk3lqb5m97fv6gsmv6bjhsdk
-rw-------  1 wwwrun www       0 Nov  9 10:33 sess_vvq82fhj9lg29gaejemlb2lrk25mqv7d
-rw-------  1 wwwrun www       0 Nov  9 20:36 sess_vvtd4ka8rfmcroa34unl06916ubj8sb9

Most of them are empty. There are not so many users on the server so I wonder where those files came from.

Is this a problem or how does apache handle those file? Do they get delete automaticly?

Could this be caused by a bad PHP file?


I assume this is from the deault session handler (you didn't say).

Yes, the files should get remove automatically, depending on the settings of session.gc_maxlifetime and session.gc_probability. If you've currently got the default settings, then increasing the latter will reduce the number of files.

But unless you have performance / capacity issues it's nothing to worry about.

That you have so many empty files implies that your server is spending a significant amount of time managing no data - if you have performance problems then smarter handling of empty sessions may help. i.e. re-engineer your code - but do read the manual on how session handling works first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.