0

I accidentally deleted a file that I have been working on for the last 2 days using the unlink() function. I was using the unlink function to delete other files but the name of the other files was similar to the file I was working on so it got deleted.

Also the same page that just got delete is still open in my browser and functioning normally. I am thinking it must be open or saved in a temp file somewhere by my Apache, could this be true? or am I dreaming?

I have tried recovery tools but I have given up on them as I am a new Ubuntu user and don't want to spend too much time fiddling around with things I don't know anything about.

SomeDude
  • 23
  • 6
  • 3
    If you just have the page open in your browser then the browser is seeing the HTML output the PHP produced. Or are you able to refresh and continue using the page? Either way this sounds like a great moment to start using vcs, like git. https://github.com/ | https://about.gitlab.com/ – JimL Apr 03 '16 at 21:03
  • No, I just checked a function on the page and it game me a 404 error object not found :( . So I will install git on my own server so I can have private repositories. Thanks JimL – SomeDude Apr 03 '16 at 21:10
  • gitlab offers free private repositories. If you decide to host yourself I strongly suggest having your repositories at least two separate locations, as you enver know when a machine/server might go up in flames. Also remember backups – JimL Apr 03 '16 at 21:13
  • Wow that sounds like a good idea. I think I'll have them in two location on my hard drive and backup to USB. Or maybe I can use gitlab, local hdd and a usb. – SomeDude Apr 03 '16 at 21:21
  • It's nice to have a local copy for quick restore, but you backup should always be off site. Preferably using a proper backup service that offer versioned backups (so you can restore files from multiple save states). Doing so pretty much removes the problem you might get if infected by a crypto virus. – JimL Apr 03 '16 at 21:23
  • If this has just occurred, maybe you should try using some undelete software. There is a good chance you can restore some file(s). I've seen people using Active Undelete, for windows, with great success. Best. – statosdotcom Apr 03 '16 at 21:24
  • @JimL Ok cool man you are the best, your advice will help me for years to come, so I really appreciate it. – SomeDude Apr 03 '16 at 21:30
  • 1
    @statosdotcom yea I tried a couple but didn't have much success, also I am not using windows :( I switched to ubuntu few weeks ago and still learning it. Thanks anyway. – SomeDude Apr 03 '16 at 21:31

1 Answers1

3

Also the same page that just got delete is still open in my browser and functioning normally. I am thinking it must be open or saved in a temp file somewhere by my Apache, could this be true?

No.

Apache executes the PHP program, sends the output of it to the client, then stops. It doesn't keep the program running after the page has been delivered.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335