|
| One Hour HTML -
Learn the language of the web in just 60 minutes. |
Setting up a Test Server on Your Own Computer
by Anthony Stai
When you're developing a website, you need to see it in action on a
real server, to see how it will work. While you could upload your pages
to your web host every time you make a change, this quickly gets
time-consuming and tiresome. Wouldn't it be great if you could have a
little test server of your own? Well, the server is nothing but a piece
of software – so you can! Please note that, for the purposes of
this article, I will assume you're using Windows as your operating
system.
Installing an IIS Test Server.
While using IIS isn't recommended, a test server is very easy to
install. All you need to do is open 'Add or Remove Programs' in
Windows' control panel. All you need to do is click Internet
Information Services (IIS), click OK, and you're done.
Of course, there are downsides to this. Many versions of Windows don't
come with IIS, and there's no way to install it on them – Windows
XP Professional, for example, comes with IIS, but Windows XP Home does
not. You might also want to consider that installing IIS on your
computer will often make it less secure.
Installing an Apache Test Server.
Compared to installing IIS, installing Apache is hard – Linux
distributions all have relatively easy ways of doing it, but Windows
wasn't designed for it. To get Apache installed, then, you're going to
need to have a little fight with the system.
Note: If you want to skip all the following steps, you might consider
using an 'easy installer' version of Apache, such as XAMPP (for
Windows), which you can get at
www.apachefriends.org/en/xampp-windows.html. The downside to this
approach is that you will be relying on them to provide new releases,
instead of being able to update things yourself.
First of all, download Apache from
http://httpd.apache.org/download.cgi. Make sure you download the
Windows Installer (MSI) version. You'll find it easiest to make the
server run as a service, as this will make it run automatically –
Apache will appear in your system tray (in the bottom-right corner of
your screen).
Now, you need to find your Apache configuration file. In the folder
where you installed Apache, look for another folder named 'conf', and
then a file named 'httpd.conf'. Open this file and look for a setting
called DocumentRoot. You should change this to point to a folder on
your hard drive, such as 'c:/html'.
Now, you've got Apache, but that's not usually much good on its own.
The chances are that you'll want to install PHP and MySQL as well, so
here's how:
Download PHP from http://www.php.net/downloads.php. Again, go for the
installer. Once you've installed PHP, find its folder, and rename the
php.ini-dist file there to php.ini. Find the 'doc_root' setting there,
and set it to the same thing you set Apache's to.
Back in Apache's httpd.conf, you should add these lines:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "c:/php"
If you didn't install PHP in c:\php, change the lines above to reflect where you put it.
Now, installing MySQL isn't as difficult, because it runs independently
of your Apache configuration. Download MySQL from
dev.mysql.com/downloads. Again, get the Windows installer version. This
installer has a lot of settings, but you'll be fine if you just click
Next through them to accept all the defaults.
The only remaining step is to enable MySQL support in PHP. Copy
libmysql.dll file from c:\php to your Windows\System32 folder, and then
open the php.ini file you created before. Remove the semicolon from the
start of the line that says ';extension=php_mysql.dll', and save the
file.
Shut down Apache and restart it, and you're done!
Visiting Your Server.
When they've installed a server on their computer, many people wonder
how they can access the server they just installed as if they were
visiting it over the web. The answer is simple: just open your web
browser, and go to this URL: http://localhost (you can also use
http://127.0.0.1). This special address means 'the server on this
computer'.
You'll know if you installed Apache successfully because you'll see a
page congratulating you. When you change your web pages, just use your
browser's Refresh button to see the effect.
About
The Author:
Anthony Stai invites you to
take your
website to the next level. Get one of the best Search Engine
Optimization (SEO) books on the market for Free! Learn the techniques
that differentiate the amateurs from the pros. Get your book at http://www.makemoneyonline4you.com/seo.html
|
|
|
|