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

  • What is the error or output that is returned to you? This is a key piece of information.... – canadmos Dec 23 '13 at 20:18
  • No output. In putty there is just the green pointer. Nothing else. – user1349390 Dec 23 '13 at 20:27
  • So then what makes you think the command didn't work? – Andrew Schulman Dec 23 '13 at 21:06
  • postimg.org/image/rnlanr2d5 this is what every time I use that command. – user1349390 Dec 23 '13 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 '13 at 20:29
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.

| improve this answer | |
  • 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. – user1349390 Dec 23 '13 at 20:35
  • What does the lsof -f command say? There could still be PHP processes running. – Teun Vink Dec 23 '13 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? – user1349390 Dec 23 '13 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 '13 at 20:45
  • It does not show any result. – user1349390 Dec 23 '13 at 20:52

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.