LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Accidently deleted www folder, what to do now (https://www.linuxquestions.org/questions/linux-newbie-8/accidently-deleted-www-folder-what-to-do-now-579361/)

zephyrcat 08-23-2007 09:23 PM

Accidently deleted www folder, what to do now
 
Hi! After installing apache, php, and mysql I was trying to figure out a good way to make it so that I would always have root abilities in that folder, and I found a tutorial that used sudo rm -r as an example of a command a newbie might not understand. (There is no explanation of what tha command does on the page.) Not thinking, I tried executing it on the /var/www folder thinking it might be the solution. It deleted the folder. Great...

So, I decided to try just making the folder again with sudo mkdir www and that worked, but the phpmyadmin folder is, of course, not there. What would the steps be to get that folder made again.

This is the tutorial I used to install apache, php, and mysql:
http://www.howtoforge.com/ubuntu_lamp_for_newbies

It is a very good tutorial, too.

Thanks!

macemoneta 08-23-2007 10:08 PM

Your options are:

1. Recover the deleted files from backup,
2. Remove and reinstall the software.

i_grok 08-23-2007 10:42 PM

And also, remember to never again run a command without looking up what it does. You'll want to the the 'man' command for this:

man rm

Even though I use commands day-in and day-out, I still check the man pages frequently when I'm dealing with sensitive data.

zephyrcat 08-24-2007 08:55 AM

Thanks. Two questions, though. How would I recover the data? I don't see it in trash. Do I just reinstall phpmyadmin or everything?

macemoneta 08-24-2007 09:11 AM

You need to remove and re-install everything that was impacted by your rm. If you can't determine what that was with any degree of certainty, then starting clean might be easier and safer.

The comment "Recover the deleted files from backup" implies that you are taking regular backups to protect yourself from just such an incident. You would then use the backed-up data to replace the files you've deleted.

zephyrcat 08-24-2007 11:11 AM

Ok, thanks. This is just my test machine, so backups are not very important.

EDIT:
Once I finally managed to uninstall it all, I started again. Apache is working just fine, but when I go the php test page all I get is a download thing to download testphp.php.

farslayer 08-24-2007 11:42 AM

err.. and never ever do rm -rf / that means DELETE EVERYTHING from my system starting at /

-r means recursive so it will go through the subdirectories under / which is everything on your system
-f means force the removal and don't prompt the user for confirmations

so now that you have the really bad commands out of the way. I hope you enjoy the rest of your Linux experience :)

zephyrcat 08-24-2007 03:47 PM

Sorry, if I was not clear. I both deleted the php and phpmyadmin directory and I uninstalled with apt-get, but now I can't get php to work.

farslayer 08-24-2007 03:58 PM

Did you remember to restart apache2 after re-installing php ?

what response do you get when you try and browse to the php test file ?

jiml8 08-24-2007 04:05 PM

If you are using the ext3 filesystem, forget about recovering from an rm. You can't.

You need to reinstall PHP and phpmyadmin. Get the PHP packages for your distro and force a reinstall. With Ubuntu, you'll have to study how to make apt install even if it thinks the package is already installed.

Phpmyadmin is no biggie; you can get it from sourceforge and since it is all PHP (just scripts) installation doesn't require a package manager; just create the directory for it, copy all the scripts in, then manually configure the details (all covered in the docs that come with phpmyadmin).

zephyrcat 08-24-2007 05:43 PM

Ugg.. wish I had know that before I messed up php. Am I correct that I can't just use a different user account? I am afraid I have already kind of messed up the reinstall. If I force a reinstall will that change back the configuration stuff?

farslayer 08-24-2007 08:45 PM

A reinstall of an application 'should' not replace the configuration files if they have been changed by you. you could always back up those config files though just in case... copy them to a folder in your user directory or something..


I would just walk through that how-to again from the start.. if you tell it to install something that already exists aptitude will skip it and tell you it's already installed. so just continue to the next step, till you complete the how-to again and hopefully everything will work itself out.

Just mark this up to a learning experience (experience is what you get, when you don't get what you want) you will remember it and likely not make the same mistake again. we've all been there, don't worry about it too much it's part of the learning process, and once you complete this project you'll know more about your system and Linux for having made the mistake. (see there is a bright side :) )

if you get hung up on anything while following the how-to again pop back in here and post teh errors you get and we'll help you work through them.


All times are GMT -5. The time now is 10:26 PM.