Friends

Thursday, January 27, 2011

How To Setup XAMPP For Web Development

XAMPP is a software package that makes it quick and easy to install Apache, MySQL, PHP and Perl on any OS.  If you need to get a local web development environment setup quickly this is a great option.  For convenience, many features are turned on by default, so while great for local development, XAMPP is not designed to be secure and ready for a production environment out of the box. The XAMPP installation is straightforward, but I wanted to provide some screenshots to guide a new user through to loading a test page in the browser successfully.  If anything is confusing, leave a comment below.
There are installs available for Linux, Windows, Mac OS X and Solaris.  The steps below are written for the Windows install.
To start, download XAMPP for Windows.  I recommend getting the EXE install.  Run the installer and select the installation destination on your PC.  I recommend sticking with the C:\ default for simplicity.
After the install is done you can start up Apache and MySQL from the XAMPP Control Panel.  If the control panel doesn’t show up right away you can launch it from the Start Menu.
If you have the built in Windows firewall running, it will ask you if you want to unblock Apache and MySQL the first time.  Go ahead and click Unblock.
Next open up your favorite browser and navigate to http://localhost/.
If Apache is running correctly you should see a splash screen where you can select your language.  After selecting that it will take you to the XAMPP home page below which gives you status information and details about the installed software packages.  You can also get to phpMyAdmin from here for working with your MySQL installation.
Now that the Apache web server is running, lets test it out with a simple Hello World example in PHP.
Navigate to the htdocs folder in your XAMPP installation (C:\xampp\htdocs by default).  Any web projects you add here will be accessible through the browser.
Create a new folder in C:\xampp\htdocs named hello.
Then create a file in the hello folder called index.php and use your favorite text editor to put this code in it.  I like Notepad ++, but Notepad works fine too.
1
2
3
<?php
echo 'Hello world!';
?>
Now go back to your browser and navigate to http://localhost/hello/index.php
If everything worked correctly your page should load with the classic programming greeting.  You now have a basic web development environment to play around in.
Got a question?  Leave a comment below.

0 comments:

Post a Comment

#
### ###