Your SlideShare is downloading. ×
Wamp & LAMP - Installation and Configuration
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Wamp & LAMP - Installation and Configuration


Published on

Configure WAMP and LAMP Server

Configure WAMP and LAMP Server

Published in: Education, Technology

  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Chetan Soni – Security Page 1WAMP & LAMPInstallation and ConfigurationByCHETAN SONI
  • 2. Chetan Soni – Security Page 2About MeI am a social-techno-learner who believes in its own efficiency first and thenimplements with the suggestions of my strong and enthusiastic Team which helps metakes everything into its perfection level.At Present, I am the Founder & Admin of blog Just Do Hackers(JDH), a security basedblog and the overall resource person of a Online Digital Library named as Seculabswhich is a product of Secugenius Security Solutions.I conducted more than 100 workshops on topics like “Botnets, Metasploit Framework,Vulnerability Assessment, Penetration Testing, Cyber Crime Investigation & Forensics,Ethical Hacking ” at various institutions/Colleges/Companies all across the world.Chetan Soni
  • 3. Chetan Soni – Security Page 3WAMP ServerRequirements/Software Needed :-1. Apache v22. PHP v53. MySql v4.14. phpMyAdminPersonally, I do my webdev on Linux, but needed to figure this out for a Windows XPHome user. I found it very easy to setup, but only because I have a lot of experience with theseproducts. For this, I can imagine this process would be very confusing. So as, these are goodinstructions to follow step-by-step to get this working. In this Project, I do not attempt to tell youHOW to use Apache, MySql, PHP, or phpMyAdmin. Instead, I explain only enough to get it alldownloaded, installed, configured, and tested.As fast as things change, these instructions may not be accurate in 30 days, but heregoes...PLEASE follow these directions in the order listed.---------------------------------------------------------------Apache - The Web Server---------------------------------------------------------------File Name: - apache_2.0.54-win32-x86-no_ssl.msi.Run the installer and follow the installation wizard using all the default options.When asked to provide a domain name, if you are just installing for personal local developmentand learning, you can enter anything you want.Try for example. This same screen will prompt for a server name andan email address. The server name must include the domain name. So you could this case, the name of your computer is "www" and the full name is "". Itdoes not have to match the actual computer name of your machine.)You can just enter your real email address--it won’t matter.If everything worked, you should now have Apache installed and configured as aWindows Service which means it will automatically start when you start Windows. You shouldhave a new icon in your System Tray that is a little red Apache feather. The icon shows the statusof your web server--green for running and red for stopped.You can click it to open the Apache Service Monitor. You use this to Stop, Start, andRestart the service. You will need to restart the service anytime you make a configurationchange.
  • 4. Chetan Soni – Security Page 4Confirm that the service is running. If not, start it.If it fails, then your problems are beyond this tutorial. Sorry.You have a web server! Open a browser and go to http://localhost.You should see the Apache default page telling you your server is working. These pages arebeing served from the Document Root, which by default a folder is named htdocs within thelocation you installed Apache.Default is C:Program FilesApache GroupApache2htdocs.I like to leave this folder alone, and create my own Document Root to build my website in. To dothis, create a folder named www on your C: drive. Navigate to your C:www folder, and create anew file using Notepad or your favorite text editor. (I recommend PSPad.)Name it index.html.Copy and paste the following into c:wwwindex.html.[HTML]<html><head><title>My Own Local Web Server</title></head><body><h1>Hello, World!</h1></body></html>[/HTML]Now we need to edit the Apache configuration to point it to our c:www folder as the DocumentRoot. To do this, again in your favorite text editor, open the Apache conf file.By default this is C:Program FilesApache GroupApache2confhttpd.confFind the line that looks like this:DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"Save your changes. Using the Apache Service Monitor, Restart the service. Open a browser andgo to http://localhost.You should see your new home page which is c:wwwindex.html.
  • 5. Chetan Soni – Security Page 5Whew! Step 1 complete.---------------------------------------------------------------PHP - The Scripting Language---------------------------------------------------------------File Name:- a folder named php on your C: drive. Unzip the file into c:php.Make a copy of c:phpphp.ini-recommended and name it c:phpphp.iniRight-click My Computer and choose Properties. Choose the Advanced tab. Click theEnvironment Variables button at the bottom.In the System Variables section, click Path, then the Edit button.At the end of the path value, add ;C:php;C:phpextClick OK and keep clicking OK until you exit out of the Properties.Reboot your computer.Now we have to modify the Apache conf so it knows to use the PHP module. To do this,again in your favorite text editor, open the Apache conf file.Find the LoadModule section that begins with a comment line that looks like this:# Dynamic Shared Object (DSO)At the end of the list of LoadModule lines, add these 4 lines:# PHP5LoadModule php5_module "c:/php/php5apache2.dll"AddType application/x-httpd-php .phpPHPIniDir "c:/php/"DirectoryIndex index.html index.html.varAnd change it to this:DirectoryIndex index.html index.html.var index.phpNow save your changes, and restart Apache.Create a new file named c:wwwindex.php.Copy these lines into it:Rename c:wwwindex.html to c:wwwold_index.htmlOpen http://localhost in your browser. You should see the phpinfo page that displays your PHPversion at top and a lot of system and user information tables.
  • 6. Chetan Soni – Security Page 6---------------------------------------------------------------MySql - The Database---------------------------------------------------------------File Name:-mysql-essential-4.1.12a-win32.msi.Run the installer and use all the default values. When prompted for a root password,choose one you can remember. Normally, security is an issue here, but if this is just for you tolearn and play, it does not matter much.Once the installation is complete, MySql should be configured as a Windows Servicewhich means it will auto start when you start Windows.You should have a new MySql folder in your Start/All Programs menu. One of the items in themenu is MySQL Command Line Client.You can use this to do all your database administration from creating databases and tables toinserting data, etc.For now, though, use the MySQL Command Line Client to test your installation. Open thecommand line client to see a password prompt.Enter your root password.Welcome to the MySQL monitor.Your MySQL connection id is 60 to server version: 4.1.12a-ntNow you need to configure PHP to work with MySql. Open c:phpphp.ini in yourfavorite text editor. There are 2 lines you need to uncomment.Save your changes. Restart the Apache service. (Thats right--since we are using php asan Apache module, anytime you change either the Apache conf file or the PHP ini file, you mustrestart Apache to see your changes.)To test that you have PHP configured to work with MySql, create a file namedc:wwwdbtest.php.You now have a WAMP system to administrate your database.
  • 7. Chetan Soni – Security Page 7LAMP ServerLAMP means Linux, Apache, MySql and PHP. Depending on who you talk to, the Palso stands for Perl or Python, but in general, it is assumed to be PHP.Initial StepsPLEASE BE AWARE THAT A SOURCE-BASED INSTALLATION LIKE THIS ONE ISNOT NEEDED FOR A BASIC LAMP SERVER!You should only be doing a source-based installation if you need to alter settings in oneor more components of the LAMP stack (e.g., you need a feature in PHP that isnt in the defaultRPM). If you are just getting started with LAMP, use the binaries provided by your distribution -it is much simpler, and a lot easier to upgrade later.Most out-of-the-box Red Hat Linux installations will have one or more of the LAMPcomponents installed via RPM files. I personally believe in installing things like this fromsource, so I get the most control over whats compiled in, whats left out, etc. But source codeinstalls can wreak havoc if overlaid on top of RPM installs, as the two most likely wont sharethe same directories, etc.If you have not yet installed your Linux OS, or just for future reference, do not chooseto install Apache, PHP, or MySQL during the system installation. Then you can immediatelyproceed with the source-based install listed – rootyum install gcc gcc-c++Log in as rootIf you do not have direct access (via keyboard) to the server, PLEASE useSecure Shell (SSH) to access the server and not telnet!! Whenever you use telnet (or plainFTP for that matter), you are transmitting your username, password, and all session informationin "plain text". This means that anyone who can access a machine someplace between your PCand your server can snoop your session and get your info. Use encryption wherever possible!su - root
  • 8. Chetan Soni – Security Page 8At the time of updating this, the current versions of all the components well use are:MySQL - 4.1.22Apache - 1.3.37PHP - 4.4.6Installing Apache2 With PHP5 And MySQL1. Preliminary StepIn this use the hostname with the IP address settings might differ for you, so you have to replace them where appropriate.2. Installing MySQL 5.0To install MySQL,yum install mysql mysql-serverThen we create the system startup links for MySQL(so that MySQL starts automatically whenever the system boots) and start the MySQL server:chkconfig --levels 235 mysqld on/etc/init.d/mysqld startRunmysqladmin -u root password yourrootsqlpasswordmysqladmin -h -u root password yourrootsqlpasswordto set a password for the user root (otherwise anybody can access your MySQL database!).3. Installing Apache2Apache2 is available as a Redhat 6.0 package, therefore we can install it like this:yum install httpdNow configure your system to start Apache at boot time...
  • 9. Chetan Soni – Security Page 9chkconfig --levels 235 httpd on... and start Apache:/etc/init.d/httpd startNow direct your browser to, and you should see the Apache2 placeholderpage:Apache’s default document root is /var/www/html on Redhat System, and theconfiguration file is /etc/httpd/httpd.conf .Additional Configurations are stored in /etc/httpd/conf.d/ Directory.4. Installing PHP5We can install PHP5 and the Apache PHP5 module as:Yum install phpWe must Restart Apache Afterwards/etc/init.d/httpd restart
  • 10. Chetan Soni – Security Page 105. Testing PHP5 / Getting Details About Your PHP5 InstallationThe document root of the default web site is /var/www/html. We will now create a smallPHP file (info.php) in that directory and call it in a browser. The file will display lots of usefuldetails about our PHP installation, such as the installed PHP /var/www/html/info.php<?phpphpinfo();?>Now we call that file in a browser (e.g. you see, PHP5 is working, and its working through the Apache 2.0 Handler, asshown in the Server API line. If you scroll further down, you will see all modules that arealready enabled in PHP5. MySQL is not listed there which means we dont have MySQL supportin PHP5 yet.
  • 11. Chetan Soni – Security Page 116. Getting MySQL Support In PHP5To get MySQL support in PHP, we can install the php-mysql package. Its a good idea to installsome other PHP5 modules as well as you might need them for your applications. You can searchfor available PHP5 modules like this:yum search phpPick the ones you need and install them like this:yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpcNow restart Apache2:/etc/init.d/httpd restartNow reload in your browser and scroll down to the modulessection again. You should now find lots of new modules there, including the MySQL module:
  • 12. Chetan Soni – Security Page 127. phpMyAdminphpMyAdmin is a web interface through which you can manage your MySQL databases.First we enable the RPMforge repository on our Redhat system as phpMyAdmin is not availablein the official Redhat repositories:On i386 systems:wget -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpmphpMyAdmin can now be installed as follows:yum install phpmyadminNow we configure phpMyAdmin. We change the Apache configuration so that phpMyAdminallows connections not just from localhost(by commenting out the <Directory "/usr/share/phpmyadmin"> stanza):vi /etc/httpd/conf.d/phpMyAdmin.conf## Web application to manage MySQL##<Directory "/usr/share/phpmyadmin"># Order Deny,Allow# Deny from all# Allow from</Directory>Alias /phpmyadmin /usr/share/phpmyadminAlias /phpMyAdmin /usr/share/phpmyadminAlias /mysqladmin /usr/share/phpmyadminNext we change the authentication in phpMyAdmin from cookie to http:vi /usr/share/phpMyAdmin/config.nic.php[...]/* Authentication type */$cfg[Servers][$i][auth_type] = http;[...]
  • 13. Chetan Soni – Security Page 13Restart Apache by this command:/etc/init.d/httpd restartAfterwards, you can Access phpMyAdmin under