<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss'><id>tag:blogger.com,1999:blog-28975952</id><updated>2009-11-27T23:47:49.815+05:30</updated><title type='text'>Animesh's Tech Blog</title><subtitle type='html'>This is the tech blog of myself, Animesh Das. I'm a Linux &amp; BSD user and administrator for years. During this years I have discovered different tricks for running a healhty and robust linux/bsd system.

Also I have encountered several problems at critical moments which is still nightmare for me. Spends hours and nights to solve the problems.

This tech blogs contain all my acheivement. Please join and write your acheivement story to help others.

KNOWLEDGE HAVE POWER, IF YOU SHARE IT!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://aniraj.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28975952/posts/default'/><link rel='alternate' type='text/html' href='http://aniraj.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Animesh</name><uri>http://www.blogger.com/profile/01389308868394628978</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-28975952.post-114924840994146055</id><published>2006-06-02T16:57:00.000+05:30</published><updated>2006-06-02T17:13:41.876+05:30</updated><title type='text'>Installation of Apache PHP MySQL Perl on Linux made easy, opensource integrated development middleware</title><content type='html'>&lt;blockquote&gt;Open source stacks such as XAMPP from Apache Friends are simplifying open source development by making it easier to write and distribute applications in a stable and standardized environment. Traditionally, AMPP -- Apache, MySQL, PHP, and Perl -- have all been installed and configured as separate products. The trend of combining them into integrated middleware stacks promises to make open source development more competitive with J2EE™ application development, at least for low-end applications. In this article, you'll learn how to install, configure, and back up XAMPP on Mandrake Linux™ 10.0 and also how to configure and administer XAMPP, as well as how to install your own applications in an XAMPP environment.&lt;/blockquote&gt;  &lt;p&gt; The advent of Java 2 Enterprise Edition™ dramatically changed the software landscape by providing an integrated middleware stack that greatly simplified the task of writing and deploying Java™ applications. For a while, the open source community was left behind because it lacked a similar integrated architecture. &lt;/p&gt;  &lt;p&gt;Recently, with the introduction of integrated open source stacks like XAMPP from Apache Friends, this situation has started to change. These stacks are still quite simple and rudimentary when compared with J2EE, but they are nevertheless an important step on the way to fuller systems integration. PHP 5.0 (which makes PHP fully object oriented) is a good indicator that this trend will accelerate. &lt;/p&gt;  &lt;p&gt; The focus of this article is on one of the integrated, open source stacks: XAMPP from Apache Friends. &lt;/p&gt;  &lt;p&gt;&lt;a name="N1005C"&gt;&lt;span class="atitle"&gt;Introducing XAMPP&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;XAMPP is a full-featured AMPP (Apache MySQL, PHP, Perl) package that is one of the few non-commercial AMPP middleware stacks available on Linux. With its tight integration, XAMPP makes it possible to run anything from a personal home page to a full-featured production site (though only for development purposes; XAMPP is not meant to be used on a production server due to security issues). &lt;/p&gt;  &lt;p&gt; XAMPP really shines in the following areas: &lt;/p&gt;  &lt;ul&gt;&lt;li&gt;It is easy to install and set up.&lt;/li&gt;&lt;li&gt;It contains a number of useful packages that make it easy to do things like generate traffic reports and accelerate PHP content.&lt;/li&gt;&lt;li&gt;It has been thoroughly tested on the SUSE, Red Hat, Mandrake, and Debian Linux distributions, as well as on Windows® and Solaris.&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt; For this article, we will install XAMPP under Mandrake Linux 10.0. Let's start by looking at the default packages that come with XAMPP. &lt;/p&gt;  &lt;p&gt;&lt;a name="N10079"&gt;&lt;span class="smalltitle"&gt;Basic packages&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; Basic packages include system, programming, and server software: &lt;/p&gt;  &lt;ul&gt;&lt;li&gt;Apache, the famous Web server&lt;/li&gt;&lt;li&gt;MySQL, an excellent, free, open source database&lt;/li&gt;&lt;li&gt;PHP, the programming language (in versions 4.3.8 and 5.0.1 at the time of this writing)&lt;/li&gt;&lt;li&gt;Perl, the programming language&lt;/li&gt;&lt;li&gt;ProFTPD, an FTP server&lt;/li&gt;&lt;li&gt;OpenSSL, for secure sockets layer support&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;a name="N10097"&gt;&lt;span class="smalltitle"&gt;Graphics packages&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; XAMPP includes the following graphics-related packages: &lt;/p&gt;  &lt;ul&gt;&lt;li&gt;GD, the "Graphics Draw" library&lt;/li&gt;&lt;li&gt;libpng, the official PNG reference library&lt;/li&gt;&lt;li&gt;libjpeg, the official JPEG reference library&lt;/li&gt;&lt;li&gt;ncurses, the character graphics library&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;a name="N100AF"&gt;&lt;span class="smalltitle"&gt;Database packages&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; And what would an integrated stack be without some database packages such as: &lt;/p&gt;  &lt;ul&gt;&lt;li&gt;gdbm, the GNU implementation of the standard UNIX® dbm library&lt;/li&gt;&lt;li&gt;SQLite, an extremely small, zero-configuration SQL database engine&lt;/li&gt;&lt;li&gt;FreeTDS, a database library that gives UNIX and Linux programs the ability to talk to Microsoft® SQL and Sybase databases&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;a name="N100C8"&gt;&lt;span class="smalltitle"&gt;XML packages&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; For XML development, XAMPP includes the following: &lt;/p&gt;  &lt;ul&gt;&lt;li&gt;expat, an XML parser library&lt;/li&gt;&lt;li&gt;Salbotron, an XML toolkit&lt;/li&gt;&lt;li&gt;libxml, an XML C parser and toolkit for GNOME&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;a name="N100DD"&gt;&lt;span class="smalltitle"&gt;PHP packages&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; For PHP development, XAMPP includes the following: &lt;/p&gt;  &lt;ul&gt;&lt;li&gt;PEAR, the PHP library&lt;/li&gt;&lt;li&gt;A pdf class that generates dynamic PDF documents with PHP&lt;/li&gt;&lt;li&gt;TURCK MMCache, a PHP performance enhancer&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;a name="N100F2"&gt;&lt;span class="smalltitle"&gt;Other packages&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; And finally, XAMPP demonstrates its versatility by including the following packages: &lt;/p&gt;  &lt;ul&gt;&lt;li&gt;zlib, a compression library&lt;/li&gt;&lt;li&gt;mod_perl, which embeds a persistent Perl interpreter in Apache&lt;/li&gt;&lt;li&gt;gettext, a toolset that assists GNU packages in producing multi-lingual messages&lt;/li&gt;&lt;li&gt;mcrypt, an encryption program&lt;/li&gt;&lt;li&gt;Ming, a Flash (SWF) output library&lt;/li&gt;&lt;li&gt;Freetype2, a software font engine&lt;/li&gt;&lt;li&gt;IMAP C-Client, a mail program API&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt; Now let's talk about installing XAMPP. &lt;/p&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" height="1" width="100%" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class="no-print" align="right" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr align="right"&gt;&lt;td&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" height="16" width="16" /&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="right" valign="top"&gt;&lt;a href="http://www-128.ibm.com/developerworks/linux/library/l-xampp/#main" class="fbox"&gt;&lt;b&gt;Back to top&lt;/b&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a name="N10116"&gt;&lt;span class="atitle"&gt;Installing and daemonizing&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; To install XAMPP, download the latest binary from the Apache Friends Web site (see &lt;a href="http://www-128.ibm.com/developerworks/linux/library/l-xampp/#resources"&gt;Resources&lt;/a&gt; for a link). Untar it to /opt using the following command: &lt;/p&gt;  &lt;p&gt; &lt;code&gt; tar xvfz xampp-linux-1.4.7.tar.gz -C /opt &lt;/code&gt; &lt;/p&gt;  &lt;p&gt;That's it! XAMPP is now installed in /opt/lampp. Any previous installations that were in /opt have been overwritten. If you are running an older version of XAMPP and don't want to download the entire package again, Apache Friends has an upgrade package available for download. &lt;/p&gt;  &lt;p&gt; Now that everything is installed, let's start the new daemons. Change your current working directory to /opt/lampp (&lt;code&gt;cd /opt/lampp&lt;/code&gt;) and enter the following: &lt;/p&gt;  &lt;p&gt; &lt;code&gt; ./lampp start &lt;/code&gt; &lt;/p&gt;  &lt;p&gt; You should see the following: &lt;/p&gt;  &lt;p&gt; &lt;code&gt; Starting XAMPP for Linux 1.4.7...&lt;br /&gt;XAMPP: Starting Apache with SSL (and PHP5)...&lt;br /&gt;XAMPP: Starting MySQL...&lt;br /&gt;XAMPP: Starting ProFTPD...&lt;br /&gt;XAMPP for Linux started. &lt;/code&gt; &lt;/p&gt;  &lt;p&gt; XAMPP is now up and running. The best way to verify this is to open a browser and type &lt;code&gt;localhost&lt;/code&gt; in the address bar and hit the Enter key. You should be redirected to the XAMPP welcome page. &lt;/p&gt;&lt;br /&gt;&lt;a name="N10156"&gt;&lt;b&gt;Figure 1. The XAMPP welcome page&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;img alt="The XAMPP welcome page" src="http://www-128.ibm.com/developerworks/linux/library/l-xampp/welcome_page.jpg" height="397" width="640" /&gt;&lt;br /&gt;&lt;p&gt; Click the &lt;b&gt;Status&lt;/b&gt; link in the left navigator to see that the necessary services have started up correctly. If all is well, you should see the following page: &lt;/p&gt;&lt;br /&gt;&lt;a name="N1016D"&gt;&lt;b&gt;Figure 2. Service status page&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;img alt="Service status page" src="http://www-128.ibm.com/developerworks/linux/library/l-xampp/status_page.jpg" height="432" width="600" /&gt;&lt;br /&gt;&lt;p&gt;Congratulations! You have just installed and set up a fully working AMPP development environment. Now let's install a simple application to demonstrate how you can use the environment. &lt;/p&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" height="1" width="100%" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class="no-print" align="right" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr align="right"&gt;&lt;td&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" height="16" width="16" /&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="right" valign="top"&gt;&lt;a href="http://www-128.ibm.com/developerworks/linux/library/l-xampp/#main" class="fbox"&gt;&lt;b&gt;Back to top&lt;/b&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a name="N1017F"&gt;&lt;span class="atitle"&gt;Installing a simple application&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;To make use of XAMPP's basic features, you need a simple application. The best application would be one that utilizes a database back end; a relatively simple database containing one table would be fine. &lt;/p&gt;  &lt;p&gt; The test database will contain one table with one column. Let's follow the (computer-) age-old tradition of test programs and plan for our table to hold a single record of "Hello World!". We'll access this database using both a Perl and a PHP script. Both scripts will access the database, retrieving the single row and outputting it to the screen. &lt;/p&gt;  &lt;p&gt;&lt;a name="N1018B"&gt;&lt;span class="smalltitle"&gt;The tool&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Our database will be created and administered using phpMyAdmin, an excellent Web-based MySQL administration tool written in PHP. It has a great user interface and allows you to do many things of varying complexity, ranging from creating/dropping/altering databases and tables to exporting data, managing keys, and processing SQL files. phpMyAdmin is a great tool because: &lt;/p&gt;  &lt;ul&gt;&lt;li&gt;It helps beginners familiarize themselves with MySQL without having to deal with what can be intimidating command-line interfaces.&lt;/li&gt;&lt;li&gt;It allows advanced users to do the more simple and routine tasks with speed and ease.&lt;/li&gt;&lt;li&gt;It's handy for those occasions when you want to give someone database administration privileges without allowing them the almighty shell access.&lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;a name="N101A0"&gt;&lt;span class="smalltitle"&gt;Creating the database&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; To create the test database in phpMyAdmin: &lt;/p&gt;  &lt;ol&gt;&lt;li&gt;Go to the XAMPP start page (localhost).&lt;/li&gt;&lt;li&gt;Select &lt;b&gt;phpMyAdmin&lt;/b&gt; in the left navigator under &lt;b&gt;Tools&lt;/b&gt;.&lt;/li&gt;&lt;li&gt;In the &lt;b&gt;Create New Database&lt;/b&gt; field on the phpMyAdmin home page, enter &lt;code&gt;hello_world&lt;/code&gt; and click &lt;b&gt;Create&lt;/b&gt;.&lt;/li&gt;&lt;/ol&gt;  &lt;p&gt; Now you must create a table within this database and specify how many fields the table should contain (a field is analogous to a column). Let's call our table "hello_table" and have it contain one field to hold our record of "Hello World!". Enter &lt;code&gt;hello_table&lt;/code&gt; in the &lt;b&gt;Name&lt;/b&gt; text field and enter &lt;code&gt;1&lt;/code&gt; in the &lt;b&gt;Fields&lt;/b&gt; text field. When you are done, click &lt;b&gt;Go&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt; Now it's time to execute the last step of database creation: choose a name and a data type definition for our column. Let's stick with the "hello" theme and name our column "hello_column"; enter &lt;code&gt;hello_column&lt;/code&gt; in the &lt;b&gt;Field&lt;/b&gt; text field. &lt;/p&gt;  &lt;p&gt; Because we will be storing the string "Hello World!" in our column, its type must be a type of &lt;i&gt;char&lt;/i&gt; with a length of 12 (the length of the string "Hello World!"). The default type &lt;i&gt;varchar&lt;/i&gt; is sufficient. In the &lt;b&gt;Length/Values&lt;/b&gt; text field next to &lt;b&gt;Type&lt;/b&gt;, enter &lt;code&gt;12&lt;/code&gt; for a max length of 12 characters. Don't worry about the rest of the fields on this page. Go ahead and click &lt;b&gt;Save&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt; If everything was done correctly, you should see the following: &lt;/p&gt;&lt;br /&gt;&lt;a name="N101FE"&gt;&lt;b&gt;Figure 3. Hello World database summary&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;img alt="Hello World database summary" src="http://www-128.ibm.com/developerworks/linux/library/l-xampp/new_table.jpg" height="467" width="600" /&gt;&lt;br /&gt;&lt;p&gt; Now let's insert our record of "Hello World!". Click the &lt;b&gt;Insert&lt;/b&gt; tab and enter "Hello World!" in the &lt;b&gt;Value&lt;/b&gt; text field. The &lt;b&gt;Function&lt;/b&gt; drop-down list can be left alone in this case. Click &lt;b&gt;Go&lt;/b&gt; to insert your "Hello World!" record into the database. &lt;/p&gt;  &lt;p&gt; To confirm that the record was inserted successfully, click the &lt;b&gt;Browse&lt;/b&gt; tab. Your "hello world" listing should be displayed. &lt;/p&gt;  &lt;p&gt;&lt;a name="N10222"&gt;&lt;span class="smalltitle"&gt;Scripting&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; Now that the back end is up and running, it's time to handle the scripting part. We will use two scripts, one in Perl and one in PHP. Our only requirements for each script will be one database connect, one database access, and an output to the screen of the retrieved row. &lt;/p&gt;&lt;br /&gt;&lt;a name="N1022F"&gt;&lt;b&gt;Listing 1. Simple database connection and retrieval in PHP using PEAR::DB&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;table bgcolor="#eeeeee" border="1" cellpadding="5" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;code class="section"&gt;&lt;br /&gt;&lt;br /&gt;require_once 'DB.php'; // must be included in any script that uses PEAR::DB&lt;br /&gt;&lt;br /&gt;// it is a huge security risk to store your database connection information&lt;br /&gt;// in the same file as your code. We have done it here solely for the purpose&lt;br /&gt;// of this example. Please store your database connection information in another&lt;br /&gt;// file that is not in your document root directory and adequately protected.&lt;br /&gt;// database connection information&lt;br /&gt;&lt;br /&gt;$db_host    = "localhost";     // hostname of the database server&lt;br /&gt;$db_user    = "root";           // database user's username&lt;br /&gt;$db_pass    = "";          // database user's password, nothing by default&lt;br /&gt;$db_name    = "hello_world";    // the name of the database to connect to&lt;br /&gt;$db_type    = "mysql";          // the type of database server.&lt;br /&gt;&lt;br /&gt;// your data source name string. This contains the connection&lt;br /&gt;// information for your database.&lt;br /&gt;$dsn = "$db_type://$db_user:$db_pass@$db_host/$db_name";&lt;br /&gt;&lt;br /&gt;// creates a database connection object or a database error&lt;br /&gt;// object based on the success of the database connection.&lt;br /&gt;$db = DB::connect($dsn, TRUE);&lt;br /&gt;&lt;br /&gt;// if an error was encountered, the script exits with an error message&lt;br /&gt;if (DB::isError($db)) {&lt;br /&gt; die($db-&gt;getMessage());&lt;br /&gt;}&lt;br /&gt;// SQL query that you wish to use to query the database&lt;br /&gt;$sql = "SELECT * FROM hello_table";&lt;br /&gt;&lt;br /&gt;// query the database, store result in $result&lt;br /&gt;$result = $db-&gt;query($sql);&lt;br /&gt;&lt;br /&gt;// exits with an error message if the query was unsuccessful&lt;br /&gt;if(DB::isError($result)){&lt;br /&gt;   die($result-&gt;getMessage());&lt;br /&gt;}&lt;br /&gt;// fetch rows from the database until no more rows exist.&lt;br /&gt;// output the "hello_column" field of each row to the screen.&lt;br /&gt;// once no more rows exist, exit with an error message.&lt;br /&gt;while($row = $result-&gt;fetchRow(DB_FETCHMODE_OBJECT)){&lt;br /&gt;   if(DB::isError($row)){&lt;br /&gt;      die($row-&gt;getMessage());&lt;br /&gt;   }&lt;br /&gt;   print("&lt;/code&gt;&lt;h1&gt;$row-&gt;hello_column&lt;/h1&gt;");&lt;br /&gt;   $result-&gt;free();&lt;br /&gt;}&lt;br /&gt;$db-&gt;disconnect(); //disconnect from the database&lt;br /&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;Each script connects to the database, retrieves a row of data, and outputs that row to the screen. PHP's database accesses are done using PEAR::DB, a handy database abstraction layer that allows the same database-access code to be used regardless of what database is implemented. Unfortunately XAMPP doesn't yet come with a database abstraction layer for Perl. &lt;/p&gt;  &lt;p&gt;&lt;a name="N10239"&gt;&lt;span class="smalltitle"&gt;Placing the scripts&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;So, now we have everything we need. Our database is up and running and we have two scripts with which to test it. All we've got to do now is put the scripts in the right place. Let's take a quick look at how XAMPP is laid out on the hard drive in &lt;a href="http://www-128.ibm.com/developerworks/linux/library/l-xampp/sidefile.html" target="new"&gt;Listing 2&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt; The directory that interests us here is /opt/lampp/htdocs/, the Apache Documents directory. Any Web pages and associated files that you want to be displayed when someone accesses your Web site's root address are placed here. Since we were able to view the XAMPP welcome page, this directory already has some files in it. Let's take a quick peek at the directory listing to confirm this (type &lt;code&gt;ls /opt/lampp/htdocs&lt;/code&gt;): &lt;/p&gt;  &lt;p&gt; &lt;code&gt; drwxr-xr-x    2 root     root         4096 Jan 24  2003 apache&lt;br /&gt;-rwxr-xr-x    1 nobody   root          163 Oct 31  2003 index.html&lt;br /&gt;drwxr-xr-x    2 nobody   root         4096 Sep 12 21:54 webalizer&lt;br /&gt;drwxr-xr-x    5 root     root         4096 Jun 15 06:24 xampp &lt;/code&gt; &lt;/p&gt;  &lt;p&gt; As you can see, there is material here already. Let's make our own directory called hello_world (&lt;code&gt;mkdir hello_world&lt;/code&gt;) in which to store our scripts. From now on, you can access all materials in the hello_world directory by typing &lt;code&gt;localhost/hello_world&lt;/code&gt;. Now, save your two scripts to that directory. You are done! &lt;/p&gt;  &lt;p&gt;&lt;a name="N10266"&gt;&lt;span class="smalltitle"&gt;Testing the application&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; To test the application, go to your browser of choice, and enter &lt;code&gt;localhost/hello_world&lt;/code&gt;. You should see the following: &lt;/p&gt;&lt;br /&gt;&lt;a name="N10275"&gt;&lt;b&gt;Figure 4. Hello World!&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;img alt="Service status page" src="http://www-128.ibm.com/developerworks/linux/library/l-xampp/hello_world.jpg" height="194" width="313" /&gt;&lt;br /&gt;&lt;p&gt; Congratulations! You have set up an application on XAMPP. &lt;/p&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" height="1" width="100%" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class="no-print" align="right" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr align="right"&gt;&lt;td&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" height="16" width="16" /&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="right" valign="top"&gt;&lt;a href="http://www-128.ibm.com/developerworks/linux/library/l-xampp/#main" class="fbox"&gt;&lt;b&gt;Back to top&lt;/b&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a name="N10287"&gt;&lt;span class="atitle"&gt;Security enhancement&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; The purpose of XAMPP is to be a development environment. It is configured to give the programmer free reign over the toolset with no restrictions. As a result of that freedom of movement, the default XAMPP installation is extremely insecure. For example, there are almost no logins required for anything. &lt;/p&gt;  &lt;p&gt; For versions of XAMPP 0.9.5 and later, you can beef up security by running the command: &lt;/p&gt;  &lt;p&gt; &lt;code&gt; /opt/lampp/lampp security &lt;/code&gt; &lt;/p&gt;  &lt;p&gt;You will be prompted with various statements that note the insecurities that exist, and you will be given a choice whether to fix that insecurity. While this makes your XAMPP installation more secure, you should still avoid running XAMPP on a production server. Listing 3 illustrates the security prompts: &lt;/p&gt;&lt;br /&gt;&lt;a name="N102A1"&gt;&lt;b&gt;Listing 3. Security issues prompted in XAMPP&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;table bgcolor="#eeeeee" border="1" cellpadding="5" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;&lt;code class="section"&gt;&lt;br /&gt;&lt;br /&gt;XAMPP: Quick security check...&lt;br /&gt;XAMPP: Your XAMPP pages are NOT secured by a password.&lt;br /&gt;XAMPP: Do you want to set a password? [yes] yes&lt;br /&gt;XAMPP: Password:&lt;br /&gt;XAMPP: Password (again):&lt;br /&gt;XAMPP: Password protection active. Please use 'lampp' as user name!&lt;br /&gt;XAMPP: MySQL is accessable via network.&lt;br /&gt;XAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes] yes&lt;br /&gt;XAMPP: Turned off.&lt;br /&gt;XAMPP: Stopping MySQL...&lt;br /&gt;XAMPP: Starting MySQL...&lt;br /&gt;XAMPP: The MySQL/phpMyAdmin user pma has no password set!!!&lt;br /&gt;XAMPP: Do you want to set a password? [yes] yes&lt;br /&gt;XAMPP: Password:&lt;br /&gt;XAMPP: Password (again):&lt;br /&gt;XAMPP: Setting new MySQL pma password.&lt;br /&gt;XAMPP: Setting phpMyAdmin's pma password to the new one.&lt;br /&gt;XAMPP: MySQL has no root passwort set!!!&lt;br /&gt;XAMPP: Do you want to set a password? [yes] yes&lt;br /&gt;XAMPP: Write the password somewhere down to make sure you won't forget it!!!&lt;br /&gt;XAMPP: Password:&lt;br /&gt;XAMPP: Password (again):&lt;br /&gt;XAMPP: Setting new MySQL root password.&lt;br /&gt;XAMPP: Setting phpMyAdmin's root password to the new one.&lt;br /&gt;XAMPP: The FTP password is still set to 'lampp'.&lt;br /&gt;XAMPP: Do you want to change the password? [yes] yes&lt;br /&gt;XAMPP: Password:&lt;br /&gt;XAMPP: Password (again):&lt;br /&gt;XAMPP: Reload ProFTPD...&lt;br /&gt;XAMPP: Done.&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" height="1" width="100%" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class="no-print" align="right" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr align="right"&gt;&lt;td&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" height="16" width="16" /&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="right" valign="top"&gt;&lt;a href="http://www-128.ibm.com/developerworks/linux/library/l-xampp/#main" class="fbox"&gt;&lt;b&gt;Back to top&lt;/b&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a name="N102A8"&gt;&lt;span class="atitle"&gt;Performing backups&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;So, your XAMPP installation has been up and running for a couple of weeks and you've amassed quite a sizeable set of data that you don't want to be at risk from a hard drive crash. What do you do about backups? &lt;/p&gt;  &lt;p&gt; This is quite simple with XAMPP. Change your current working directory to /opt/lampp (&lt;code&gt;cd /opt/lampp&lt;/code&gt;) and type in the following command: &lt;/p&gt;  &lt;p&gt; &lt;code&gt; ./lampp backup &lt;/code&gt; &lt;/p&gt;  &lt;p&gt;You will want to add on your MySQL root password if you have it set to the end of that command. You should then see the following: &lt;/p&gt;  &lt;p&gt; &lt;code&gt; Backing up databases...&lt;br /&gt;Backing up configuration, log and htdocs files...&lt;br /&gt;Calculating checksums...&lt;br /&gt;Building final backup file...&lt;br /&gt;Backup finished.&lt;br /&gt;Take care of /opt/lampp/backup/xampp-backup-15-09-04.sh&lt;br /&gt;&lt;/code&gt; &lt;/p&gt;  &lt;p&gt; To restore your backup, run the following command as root: &lt;/p&gt;  &lt;p&gt; &lt;code&gt; sh backupfilename &lt;/code&gt; &lt;/p&gt;  &lt;p&gt; You will see the following if all goes well: &lt;/p&gt;  &lt;p&gt; &lt;code&gt; Checking integrity of files...&lt;br /&gt;Restoring configuration, log and htdocs files...&lt;br /&gt;Checking versions...&lt;br /&gt;Installed:   XAMPP 1.4.7&lt;br /&gt;Backup from: XAMPP 1.4.7&lt;br /&gt;Restoring MySQL databases...&lt;br /&gt;Restoring MySQL user databases...&lt;br /&gt;Backup complete. Have fun!&lt;br /&gt;You may need to restart XAMPP to complete the restore.&lt;br /&gt;&lt;/code&gt; &lt;/p&gt;  &lt;p&gt; Restart XAMPP (&lt;code&gt;cd /opt/lampp, ./lampp restart&lt;/code&gt;), and your restored data should be readily available. &lt;/p&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" height="1" width="100%" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class="no-print" align="right" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr align="right"&gt;&lt;td&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" height="16" width="16" /&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="right" valign="top"&gt;&lt;a href="http://www-128.ibm.com/developerworks/linux/library/l-xampp/#main" class="fbox"&gt;&lt;b&gt;Back to top&lt;/b&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a name="N10302"&gt;&lt;span class="atitle"&gt;Ready to rAMPP up?&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Whether integrated solution stacks ever fully compete with J2EE solutions remains to be seen, but the recent release of PHP 5.0 (its major addition includes full object orientation) coupled with the rapid growth of the MySQL database indicates that integrated AMPP solution stacks are becoming more popular among developers. This means that open source middleware stacks like XAMPP might have some elbow room at the lower end of the software market. &lt;/p&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" height="1" width="100%" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class="no-print" align="right" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr align="right"&gt;&lt;td&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" height="16" width="16" /&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="right" valign="top"&gt;&lt;a href="http://www-128.ibm.com/developerworks/linux/library/l-xampp/#main" class="fbox"&gt;&lt;b&gt;Back to top&lt;/b&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a name="resources"&gt;&lt;span class="atitle"&gt;Resources&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;     &lt;ul&gt;&lt;li&gt;Download XAMPP at &lt;a href="http://www.apachefriends.org/en/"&gt;Apache Friends&lt;/a&gt;, a nonprofit organization that promotes the Apache Web server and has the latest XAMPP information and releases.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.ibm.com/developerworks/linux/library/l-php.html"&gt;Introduction to PHP&lt;/a&gt; (developerWorks, December 2000) can get you started on the PHP scripting language. And while you're there, just type "PHP" into the search field for links to some of the many PHP resources available from IBM.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The &lt;i&gt;&lt;a href="http://www.ibm.com/developerworks/views/linux/articles.jsp?sort_order=desc&amp;expand=&amp;amp;sort_by=Date&amp;show_abstract=true&amp;amp;view_by=Search&amp;search_by=better+programming%3A"&gt;Road to better programming&lt;/a&gt;&lt;/i&gt; series (developerWorks) is an excellent hands-on series for sharpening your Perl perspective. For more on Perl, search the developerWorks site.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;These two articles, &lt;a href="http://www.ibm.com/developerworks/db2/library/techarticle/dm-0409casey/"&gt;Connecting PHP Applications to Apache Derby&lt;/a&gt; (developerWorks, September 2004) and &lt;a href="http://www.ibm.com/developerworks/db2/library/techarticle/dm-0409cline/index.html"&gt;Develop Perl applications with Apache Derby&lt;/a&gt; (developerWorks, October 2004) are a must-read for PHP and Perl application developers.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The &lt;a href="http://www.phpmyadmin.net/home_page/"&gt;phpMyAdmin project&lt;/a&gt; contains a lot of great information as well as downloads of the awesome Web-based MySQL administration tool.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.amazon.com/exec/obidos/ASIN/0596003234"&gt;&lt;i&gt;Practical Unix &amp;amp; Internet Security&lt;/i&gt;&lt;/a&gt; (O'Reilly &amp;amp; Associates, 1996) is an excellent reference on all aspects of system security from user management to drafting a security policy.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.php.net/"&gt;PHP.net&lt;/a&gt; offers an online searchable function library that is a great aid to finding detailed information on PHP methods and to hunting down builds of the language.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://pear.php.net/"&gt;The PHP Extension and Application Repository&lt;/a&gt; (PEAR) offers components that make programming PHP simpler, including the ever-popular &lt;a href="http://pear.php.net/package/DB"&gt;PEAR::DB&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;For help with MySQL, the &lt;a href="http://dev.mysql.com/doc/"&gt;MySQL reference manual&lt;/a&gt; contains detailed information on all aspects of the popular database.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Visit the &lt;a href="http://httpd.apache.org/"&gt;Apache HTTP Server Project&lt;/a&gt; for the latest builds and information on the Web's most popular http server.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Find more resources for Linux developers in the &lt;a href="http://www.ibm.com/developerworks/linux/"&gt;developerWorks Linux zone&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Download no-charge trial versions of IBM middleware products that run on Linux, including WebSphere® Studio Application Developer, WebSphere Application Server, DB2® Universal Database, Tivoli® Access Manager, and Tivoli Directory Server, and explore how-to articles and tech support, in the &lt;a href="http://www.ibm.com/developerworks/offers/linux-speed-start/"&gt;Speed-start your Linux app&lt;/a&gt; section of developerWorks.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Get involved in the developerWorks community by participating in &lt;a href="http://www.ibm.com/developerworks/blogs/"&gt;developerWorks blogs&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.ibm.com/developerworks/apps/SendTo?bookstore=safari"&gt;Browse for books&lt;/a&gt; on these and other technical topics.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://www.ibm.com/i/v14/rules/blue_rule.gif" alt="" height="1" width="100%" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;table class="no-print" align="right" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr align="right"&gt;&lt;td&gt;&lt;table border="0" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="middle"&gt;&lt;img src="http://www.ibm.com/i/v14/icons/u_bold.gif" alt="" border="0" height="16" width="16" /&gt;&lt;br /&gt;&lt;/td&gt;&lt;td align="right" valign="top"&gt;&lt;a href="http://www-128.ibm.com/developerworks/linux/library/l-xampp/#main" class="fbox"&gt;&lt;b&gt;Back to top&lt;/b&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a name="author"&gt;&lt;span class="atitle"&gt;About the author&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td colspan="3"&gt;&lt;img alt="" src="http://www.ibm.com/i/c.gif" height="5" width="100%" /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr align="left" valign="top"&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;img alt="" src="http://www.ibm.com/i/c.gif" height="5" width="4" /&gt;&lt;/td&gt;&lt;td width="100%"&gt;&lt;p&gt;Nils-Erik Frantzell is currently studying computer science at the University of California, Santa Cruz. His interests include Linux, Web programming (particularly PHP), networking, open source technologies, and fiddling with computer hardware. He spends his time away from the computer tending to his carnivorous fishes while listening to electronic music. You can contact Nils-Erik at &lt;a href="mailto:nfrantze@ucsc.edu"&gt;nfrantze@ucsc.edu&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;This is a copy of the article be found at http://www-128.ibm.com/developerworks/linux/library/l-xampp/&lt;br /&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28975952-114924840994146055?l=aniraj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aniraj.blogspot.com/feeds/114924840994146055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=28975952&amp;postID=114924840994146055' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28975952/posts/default/114924840994146055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28975952/posts/default/114924840994146055'/><link rel='alternate' type='text/html' href='http://aniraj.blogspot.com/2006/06/installation-of-apache-php-mysql-perl.html' title='Installation of Apache PHP MySQL Perl on Linux made easy, opensource integrated development middleware'/><author><name>Animesh</name><uri>http://www.blogger.com/profile/01389308868394628978</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='16108364680503189415'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-28975952.post-114898278365816292</id><published>2006-05-30T15:19:00.000+05:30</published><updated>2007-02-20T10:22:42.533+05:30</updated><title type='text'>Data recovery technique from corrupted ext2/ext3 filesystem having bad superblock</title><content type='html'>&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold; font-style: italic;font-family:verdana;" &gt;NOTE : I do not take any responsibilty of any damage to your disk or data &lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;font-family:verdana;" &gt;while trying my technique or any of my commands stated in this article. &lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;font-family:verdana;" &gt;YOU HAVE BEEN WARNED!!!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;1. Let's say our corrupted filesystem is at partition /dev/sdb3 of ext3 type. &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;We will mount the partition under /mnt/sdb3, so create the directory structure &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;if you dont have it already.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Also, create the following directory structure to keep backup data.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;&lt;/span&gt;&lt;blockquote  style="font-family:verdana;"&gt;&lt;span style="font-style: italic;"&gt;mkdir /sdb3-backup&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;mkdir /sdb3-backup/image&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;mkdir /sdb3-backup/copy&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Note that ext3 filesystem is same as ext2, with only addition of &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;journal. So our entire technique will use ext2 filesystem if even &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;our corrupted filesystem is ext3 type. Because our aim is to &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;recover data not journal recovery (which is unrecoverable as far as I know). &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;So be carefull while you issue any of my commands, unless explicitly told &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;dont add any ext3 filesystem type in any of our command. Use all my command &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;as it is written below.  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;2. Before applying this technique be sure that your superblock is corrupt only &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;not the entire disk or something else.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:verdana;" &gt;USE THE INSTRUCTION BELOW TO CHECK IT&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;A. Try to mount the disk read only using &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;&lt;blockquote&gt;mount -t ext2 /dev/sdb3 /mnt/sdb3 -o ro&lt;/blockquote&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;OR&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;&lt;blockquote&gt;mount -t ext2 -o ro,errors=recover,errors=continue /dev/sdb3 /mnt/sdb3&lt;/blockquote&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Check the message you are getting. it must be something like below :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;blockquote style="font-weight: bold; font-style: italic; font-family: courier new;"&gt;mount: wrong fs type, bad option, bad superblock on /dev/sdb3,&lt;br /&gt;   or too many mounted file systems&lt;/blockquote&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;B. Now try "dmesg | more" to actually verify if the superblock is really damaged. &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;We will see a line like below :&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;blockquote style="font-style: italic; font-family: courier new;"&gt;EXT2-fs: unable to read superblock&lt;/blockquote&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Now we will first start to recover the data by mounting it &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;then we will try to correct the filesystem. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;3. Before doing that I'd recommend taking an image, &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;something like&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;blockquote&gt;dd if=/dev/sdb3 of=/sdb3-backup/image/backup &lt;/blockquote&gt;&lt;/span&gt;&lt;br /&gt;and then using the loop &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;device to work on that. If the partition's bigger than 2 gig you will &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;probably need to compress it first with something like&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-style: italic;"&gt;dd if=/dev/sdb3 | &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-style: italic;"&gt;gzip &gt; /sdb3-backup/image/backup.gz&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;br /&gt;(note that if it's compressed the loop device won't &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;work and you'll have to work on the bare hardware). If using an alternate &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;superblock doesn't work a last ditch fix may be&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-style: italic;"&gt;mke2fs -S /sdb3-backup/image/backup &lt;/span&gt;(or &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;span style="font-style: italic;"&gt;mke2fs -S /dev/sdb3&lt;/span&gt; if the dd result was too big). &lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;This will rewrite the &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;superblocks, you will then need to run e2fsck to clean up. This did the&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;trick for me on a drive that got a whole bunch of bad sectors that I had &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;to get data off. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Hmm, if I'd only have a HDD to save the data, I would be happy :) ; then I &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;could probably do&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-style: italic;"&gt;dd if=/dev/hda2 of=/dev/xyz&lt;/span&gt;&lt;br /&gt;and &lt;span style="font-style: italic;"&gt;&lt;br /&gt;e2fsck -b 32768 /dev/xyz&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;&lt;br /&gt;e2fsck would restore the first superblock and my problems were gone...&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;but I have no second hard disk which is that big :(.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;4. Linux file system writes backup of superblock in different locations. &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;Find the backup superblocks using &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style=";font-family:verdana;font-size:85%;"  &gt;&lt;span style="font-style: italic;"&gt;mke2fs -n /dev/sdb3&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;span style="font-family:verdana;"&gt;The above command will give you a result like below&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;blockquote style="font-style: italic; font-family: courier new;"&gt;mke2fs 1.35 (28-Feb-2004)&lt;br /&gt;Filesystem label=&lt;br /&gt;OS type: Linux&lt;br /&gt;Block size=4096 (log=2)&lt;br /&gt;Fragment size=4096 (log=2)&lt;br /&gt;14385152 inodes, 28754341 blocks&lt;br /&gt;1437717 blocks (5.00%) reserved for the super user&lt;br /&gt;First data block=0&lt;br /&gt;878 block groups&lt;br /&gt;32768 blocks per group, 32768 fragments per group&lt;br /&gt;16384 inodes per group&lt;br /&gt;Superblock backups stored on blocks:&lt;br /&gt;    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,&lt;br /&gt;    4096000, 7962624, 11239424, 20480000, 23887872&lt;/blockquote&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;4. Now please note the superblock backup blocks number at the last line &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;and the block size(which is multiple of 1K=1024b). In our case &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;the block size is 4096 that mean 4K (4096/1024=4)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;While the block number which must be given to mount is based on the blocksize &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;which is installed on the hard disk (4k in my case), the block number which must &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;be given to mount is calculated on a 1k-block-basis, so I had to multiply 32768*4.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Now we will try to mount the corrupted filesystem partition. We have to tell mount &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;command to use backup superblocks so we will calculate the first backup superblock &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;(if it is OK) 32768*4 = 131072. Now mount with the command below :&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;&lt;blockquote&gt;mount -t ext2 -o sb=131072 /dev/sdb3 /mnt/sdb3&lt;/blockquote&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Now imagine the backup at position 32768 was damaged too . . . then you just try again &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;with the backup stored at position 98304, and 163840, and 229376 etc. etc. until you find an &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;undamaged backup  ( there are several backups so if at least one of those five is okay it´s bingo ! )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Use the formula below to calculate the backup superblock location :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;Superblock backups stored on blocks location * Block size in K(i.e.Block size/1024) = N&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;mount -t ext2 -o sb=N /dev/sdb3 /mnt/sdb3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;(replace N with the result of the calculation)&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-style: italic;font-family:verdana;" &gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;5. If you successfully able to mount the partition, go to the mounted partion and copy data using &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;blockquote style="font-style: italic;"&gt;&lt;span style="font-family:verdana;"&gt;cd /mnt/sdb3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;cp -R /mnt/sdb3/data /sdb3-backup/copy/.&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family:verdana;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;If any of the above steps fails. You need to consult a experienced data recovery experts.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;In 90% case of damaged superblock this technique of data recovery works. Hope the above  &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;technique will help you too. Please post your result if you use the technique in &lt;/span&gt;&lt;span style="font-family:verdana;"&gt;this article.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;And at last I would like to say "&lt;span style="font-weight: bold;"&gt;ALWAYS BACKUP YOUR DATA IN MULTIPLE / DISK OR MEDIA&lt;/span&gt;" so &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;if one fails you can restore from others.&lt;br /&gt;&lt;br /&gt;Please post your comments, to let others know about the technique failure and success rate.&lt;br /&gt;If you have any other sucessfull method to recover data, please post it.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;Acknowledgement :&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;http://www.linuxforums.org/forum/misc/35926-cannot-boot-up-linux-unable-read-superblock.html&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;http://www.ussg.iu.edu/hypermail/linux/kernel/0104.2/1353.html&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;http://www.brunolinux.com/04-The_File_System/Damaged_Superblock.html&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:verdana;"&gt;http://lists.debian.org/debian-user/2001/09/msg01200.html &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/28975952-114898278365816292?l=aniraj.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aniraj.blogspot.com/feeds/114898278365816292/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=28975952&amp;postID=114898278365816292' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/28975952/posts/default/114898278365816292'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/28975952/posts/default/114898278365816292'/><link rel='alternate' type='text/html' href='http://aniraj.blogspot.com/2006/05/data-recovery-technique-from-corrupted.html' title='Data recovery technique from corrupted ext2/ext3 filesystem having bad superblock'/><author><name>Animesh</name><uri>http://www.blogger.com/profile/01389308868394628978</uri><email>noreply@blogger.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='16108364680503189415'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry></feed>