Home Login Registration Authors Contact Us About Us Subscribe
Want to receive new articles via e-mail? Click here!
: Home  :: Web Hosting  :: Web Hosting General
Installing a Personal Web Server
by Webdevinfo - Webmaster
Views: 964
Votes: none
Rating: 0.00
Synopsis:
So you want to run your own Web Server on your computer to test and play around with scripting languages like PHP & MySQL? Installing it for yourself is ideal because:
Rate this article  Print this article  Email this article  View this article in PDF  Discuss this article
Page:  1 | 2 |  Next >  Last
The Article

 

So you want to run your own Web Server on your computer to test and play around with scripting languages like PHP & MySQL?  Installing it for yourself is ideal because:

1.) You learn a great deal about the PHP & MySQL environment.
2.) You are forced to modify configuration files, which helps you figure out problems later on.
3.) You don't have to pay for a web host.
4.) It’s the most convenient way to test your scripts.

This tutorial expects you to use Windows 98/ME/2000/NT/XP (it is preferable to install a web server on 2000/NT or XP because of its stability), and a moderately fast computer.  You don't need an expensive machine to run the server, but it can slow down your system considerably.  You will also need about 75 megabytes of free disk space (more will be needed for database entries and scripts).  We will cover the installation of the Apache Web Server, the PHP Hypertext Pre-processor, the MySQL Database, and phpMyAdmin, all of which are free to use.

Note: All of the software above, except for MySQL, is called "Open Source."  This means that you can take them, decompile them, and release it as your own again all for free, with their free licence of course.  MySQL is the exception, and in this case, you are allowed to use the software for free, but you are required to purchase a licence from them for legal rights to the source code.

So, let's begin the fun, shall we?

The Necessary Software

Apache:
I use only the latest stable release of software, except for Apache, which I use version 1.3.28 instead of 2.0.47.  I feel that Apache 1.3.28 has more that enough options and is more stable than version 2, and being the last release of version 1, it has almost all of the bugs fixed.  Most servers on the Internet also use this version of Apache.  You can download it
here or if you wish to choose a different mirror for the download, you can do so here, but be sure to download the Win32 Binary, or *.msi file of version 1.3.28.

PHP:
For PHP, I use the latest stable release of version 4, since version 5 is only in Beta.  You can choose any mirror you wish
here. The official site also has excellent documentation on the installation and language of PHP, which you can view here.

MySQL:
For MySQL, it is best to choose version 4, which is the recommended version of the database software.  You can choose the download from a list of mirrors found
here.

phpMyAdmin:
Although phpMyAdmin is not really part of the web server, it is very useful for beginners in MySQL.  They update their script very often, so it is useful to grab the newest copy when they come out with it, since it usually has many improvements.  You can download the script
here.

Now that we have all the software, we just have to install it.

Apache Install

Before we start installing, I must tell you that on the first install attempt, you might receive errors.  This is normal, and almost everyone gets them, but in order to try again you must first uninstall it through the proper Windows uninstaller, or you might not be able to run it again.  The uninstaller is located in Start>Settings>Control Panel>Add/Remove Programs.  To uninstall Apache or MySQL properly, you must first uninstall it through Windows, and then go to the directory in which you installed it before, and delete all files, since it’s useful to provide these programs with a fresh configuration.

Now let's begin.

Apache Install:

Once you load the *.msi file which you downloaded, and you will come to an install page.  Follow the installation instructions until you reach a page called "Server Information".  There are many text boxes on this page, and a couple of options at the bottom.  You should fill them as shown below:

   Network Domain: localhost
   Server Name: localhost
   Administrator's Email Address:
admin@localhost

For the area below the text fields with the radio boxes, you need to decide which to choose from.  If you choose the first option, Install as a Service, Apache loads upon start-up, and out of the way so it doesn't bother your other applications.  This is definitely recommended unless your computer is low on memory (RAM), in which case you should choose the second option.  If you choose the second option, you will need to load up Apache every time you wish to use the web server, and it shows up as an open application like Internet Explorer.  To keep Apache running in this mode, you need to keep it minimized all the time.

Note: If you install under Windows 95/98/ME, Apache will automatically install as a manual application, meaning the second option in the install.

Once you have filled in all of the text-boxes and chosen one of the install options, click Next and choose "Complete" install.  On the next page, there is a button called "Change..." for the install path.  Click this button and in the selected text-box, type in "c:web".  After this, your all set and are ready to install the program.  Just continue the install wizard and press "Install". 

Now that we have it installed, its time to make sure that everything works properly.  Go to "Start>Programs>Apache HTTP Server".  If you see an option called "Start Apache in Console", click that (you will need to do this every time you wish to load up Apache).  Otherwise, there should be a shortcut called "Control Apache Server".  Click that and then click on the option titled "Start Apache Server".  A DOS window should load up and disappear shortly.  Now, open up your internet browser and type into the address "http://127.0.0.1/".  If you see an Apache page, pat yourself on the back because you have successfully installed Apache. 

Next, we need to configure Apache properly on your system.  To do this, we will have to edit Apache's Server Configuration File, which controls all aspects of the server.  Go to the folder "c:webApacheconf" and open the file "httpd.conf" in a text-editor. 

Note:  A common text-editor is Microsoft Notepad.  You must be careful not to use a word processor like Microsoft Word or Microsoft WordPad because the application encodes the file differently, stopping programs like Apache from reading it.

Once opened, you will need to change a few variable statements.  Since the file is quite large, it is much easier to search with the parts we need to change.  In most editors, you can enable the search by pressing "ctrl+f", which brings up a prompt.  Just type in what I have in here and change the information.

1.  Search for: ServerName
    This variable tells Apache how to access your server locally, rather than the local IP address.
    If, after ServerName, there is no more text, type in localhost.  Otherwise skip this step and go on.

2.  Search for: DocumentRoot
    This tells Apache where to look for the files to show up when you access the server.  This is basically where you put your website.
    First, create a new folder in the "c:web" folder called "www".  Next, change the system path already given to "c:/web/www/".  Make sure the path is in quotes.

Note:  In Apache, the system path uses the Unix "/", of forward-slash, instead of the Windows back-slash, "".

3.  Search for : <Directory "C:/web/Apache/htdocs
    This is the first Directory configuration in the file, and is most likely the only one you will ever need.
    Change the entire line to: <Directory "c:/web/www">

4.  Search for: Options Indexes FollowSymLinks MultiViews
    This tells Apache the folder options for the Server Root and subdirectories.
Go on to the PHP Install.
    Change this entire line to: Options MultiViews All

5.  Go to the end of the document and add a couple of extra lines.  Here, we are going to add the PHP Module for Apache, so we don't have to open the Apache Configuration again.

At the bottom of the file, copy this info:

  # PHP
  # PHP as a Module
    LoadModule php4_module c:/web/php/sapi/php4apache.dll
  # AddModule mod_php4.c
    AddType application/x-httpd-php .php .php3 .php4 .phtml
    AddType application/x-httpd-php-source .phps

And you’re done!  You have completed the most difficult part of installing your server, and it gets significantly easier from here on.  DO NOT restart Apache just yet, because we need to install the PHP files first.  If you do restart, it will create an error for most users.  Now, continue onto the PHP Installation.

Page:  1 | 2 |  Next >  Last
Rate this article  Print this article  Email this article  View this article in PDF  Discuss this article
Similar/related articles:
Advanced Search
Site Search:


FirstWebHosting
Top Ten Hosts as picked by our editors - with reviews and interviews.
The Host Planet
Web hosting reviews and ratings. Learn how to spot a great host.
Hosts2002
The first and greatest hosting directory with the consumer in mind.
Hostcue.com
Hosting directory for the masses with special offers Check us out!
WebDevForums
Web developers or all levels discuss the details of design and ecommerce.
Needscripts.com
Free scripts and applications for web developers.