LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-23-2007, 10:23 PM   #1
zephyrcat
Member
 
Registered: Jun 2007
Posts: 107

Rep: Reputation: 15
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!
 
Old 08-23-2007, 11:08 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
Your options are:

1. Recover the deleted files from backup,
2. Remove and reinstall the software.
 
Old 08-23-2007, 11:42 PM   #3
i_grok
Member
 
Registered: Jun 2006
Location: Massachusetts
Distribution: Gentoo
Posts: 79

Rep: Reputation: 16
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.
 
Old 08-24-2007, 09:55 AM   #4
zephyrcat
Member
 
Registered: Jun 2007
Posts: 107

Original Poster
Rep: Reputation: 15
Thanks. Two questions, though. How would I recover the data? I don't see it in trash. Do I just reinstall phpmyadmin or everything?
 
Old 08-24-2007, 10:11 AM   #5
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
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.
 
Old 08-24-2007, 12:11 PM   #6
zephyrcat
Member
 
Registered: Jun 2007
Posts: 107

Original Poster
Rep: Reputation: 15
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.

Last edited by zephyrcat; 08-24-2007 at 12:35 PM.
 
Old 08-24-2007, 12:42 PM   #7
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
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
 
Old 08-24-2007, 04:47 PM   #8
zephyrcat
Member
 
Registered: Jun 2007
Posts: 107

Original Poster
Rep: Reputation: 15
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.
 
Old 08-24-2007, 04:58 PM   #9
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
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 ?
 
Old 08-24-2007, 05:05 PM   #10
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
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).
 
Old 08-24-2007, 06:43 PM   #11
zephyrcat
Member
 
Registered: Jun 2007
Posts: 107

Original Poster
Rep: Reputation: 15
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?
 
Old 08-24-2007, 09:45 PM   #12
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
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.

Last edited by farslayer; 08-24-2007 at 09:54 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleted /boot directory accidently!!! jim_cliff11 Linux - Software 3 10-21-2006 02:41 PM
accidently deleted my ~/.Xauthority behmjoe Linux - Software 4 12-14-2005 11:53 PM
I accidently deleted /udev folder, what can I do? QuickTime Mandriva 1 09-29-2004 07:00 AM
Help: Accidently deleted file patske Linux - Newbie 5 02-17-2004 10:34 AM
/usr/local folder contents accidently deleted jshaikh Linux - Newbie 1 07-12-2003 02:55 PM


All times are GMT -5. The time now is 07:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration