Adi Ulici
Adi Ulici

Reputation: 1295

PHP fails to write sessions

I have a problem with one of my sites: php won't write the sessions any more. The site was working (for a few months already) and this error popped a few days ago:

Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/backup/sess) in Unknown on line 0

I have enough space on the server, but I checked out the specific directory and it has a size of 32M. I think the guys who manage my server put a limit on the dir. Is it ok if I empty the directory and delete all the sessions inside? Or what should I do?

Thanks

Upvotes: 0

Views: 222

Answers (4)

TimWolla
TimWolla

Reputation: 32701

It should be safe to delete them, as they are only textfiles and users will get a new session.

But: Is it intended, that the sessions are saved within /backup?

Upvotes: 2

lorenzo-s
lorenzo-s

Reputation: 17010

I think you can safely delete older files, I mean, if you delete all files older than 2 days you can be sure nothing go wrong. Anyway, try to ask to increase space for sessions.

Upvotes: 2

Pekka
Pekka

Reputation: 449613

Or what should I do?

Arbitrarily removing files can help in the short term, but might destroy sessions that are currently active, and won't solve the root problem: the same thing will happen again in a few days or weeks.

Talk to the guys who manage your server and ask (or tell) them to increase the limit. They should also look into whether the session directory is getting properly garbage collected (ie., whether expired sessions are getting removed).

Upvotes: 3

RageZ
RageZ

Reputation: 27323

You can safely delete all the file in the directory, simply all your user will loose their session.

After depending on the distribution on your server and your PHP settings you probably want to shorten or delete the session files more often. Another solution would be to give more space to your session directory.

Upvotes: 1

Related Questions