0

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

6
  • What is the error or output that is returned to you? This is a key piece of information....
    – canadmos
    Dec 23, 2013 at 20:18
  • No output. In putty there is just the green pointer. Nothing else. Dec 23, 2013 at 20:27
  • So then what makes you think the command didn't work? Dec 23, 2013 at 21:06
  • postimg.org/image/rnlanr2d5 this is what every time I use that command. Dec 23, 2013 at 21:08
  • 1
    Are there lots of files in the directory? IF so, it may take the shell a long time to list them. Try using e.g. find instead of running rm directly.
    – Jenny D
    Dec 24, 2013 at 20:29

1 Answer 1

0

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.

14
  • I am running a webserver. (apache) I tried to turn it off and delete those file but still no success. I could not delete them. Dec 23, 2013 at 20:35
  • What does the lsof -f command say? There could still be PHP processes running.
    – Teun Vink
    Dec 23, 2013 at 20:39
  • That command says a lot of things. I do not understand what it says... Should I look up for any thing in particular? Dec 23, 2013 at 20:45
  • Try lsof -f | grep /var/lib/php/session/, if this returns any results there are still processes with open files in that directory.
    – Teun Vink
    Dec 23, 2013 at 20:45
  • It does not show any result. Dec 23, 2013 at 20:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .