I try to empty a folder (/var/lib/php/session/) with putty on ssh, but I does not work. I do not know what goes wrong.
This is the command I use:
rm -rf /var/lib/php/session/*
Every time I run this command, it hangs without returning. Thanks
Probably some of those files are still in use by a running PHP process. You can use lsof -f
to verify this.
Are (another assumption since you're not providing many details) you running a webserver (Apache, nginx, etc) from which the PHP scripts are served? In that case you can stop the webserver, try running your command again and then start the webserver again, but keep in mind that this wil break visitors' websessions since you're removing all session data.
lsof -f
command say? There could still be PHP processes running.
Dec 23, 2013 at 20:39
lsof -f | grep /var/lib/php/session/
, if this returns any results there are still processes with open files in that directory.
Dec 23, 2013 at 20:45
find
instead of running rm directly.