IT.COM

HOWTO: Install the Apache Web Server, Perl, PHP, and MySQL on Windows

Spaceship Spaceship
Watch
Impact
6
This tutorial is old and you can find a more up to date version here or here.

Code:
        //
       //  
      //Tutorial by deadserious - © [url]http://www.webdesigntalk.net[/url]
     //© 2003 [url]http://www.webdesigntalk.net[/url] 
    //REPUBLICATION OF THE TUTORIAL REQUIRES OUR PERMISSION.
   //[email protected] 
  //
 //
//

  • NOTES:
  • Click Here to view this tutorial outside the forum.
  • This tutorial was written using a Windows 98 Machine. The same basic steps should work on Windows ME/2000/XP.
  • If installing on another Windows version certain things will be slightly different such as how you stop and start services, but you should be able to figure it out.
  • This tutorial used the latest versions of Apache and PHP which aren't fully supported/tested yet, but well this is just for learning and testing on your home computer and everyone will eventually need to upgrade to these versions anyways.
  • This tutorial shows you how to set up PHP as a CGI binary. I havn't succeded in setting up PHP as an Apache module with Apache 2.0 on Windows yet, but if and when I do I'll update this tutorial.
  • This tutorial was set up to make things similar to most hosts out there. So when you're done testing your scripts and pages you wont have to make so many changes when you're ready to upload them on to your hosts server.
STEP 1: Check and see if you have Microsoft windows installer:
Go to Start --> Run --> Type MSIEXEC in the input box and hit enter to see if it's installed and what version. You need to have atleast version 2.0. You will see a message box that says "Incorrect command line parameters", along with the version number. You can install or upgrade with the following downloads if you need to: Windows Installer 2.0 Redistributable for Windows 95, 98, and Me

Windows Installer 2.0 Redistributable for Windows NT 4.0 and 2000:

STEP 2: Download and install the Apache Web Server:
http://nagoya.apache.org/dist/httpd/binaries/win32/ Download the latest stable release that ends with the .msi extension apache_2.X.XX-win32-x86-no_ssl.msi. Make sure the version you download has no_ssl or no_src in it. Click on the installation program you just downloaded until you see:

Welcome to the installation Wizard for Apache HTTP Server 2.0.43
Continue through the set up, accept the license agreement, continue until you get to the screen that says:

Server Information
Please enter your servers information

Enter "localhost" without the quotes in the Network Domain input box.

Enter "localhost" without the quotes in the Server Name input box.

Enter any email address you'd like to in the Administrator's Email input box.

Click Next --> Click Next

You'll have an option to change the installation to a different folder.

Click Change

Enter "C:" without the quotes for the folder name.

Click OK --> Click Next --> Click Install --> Click Finish

Apache should now be installed in the C:Apache2 directory.

STEP 3: Configure Apache to enable some good stuff.
Browser to the directory where the httpd.conf file is located: C:Apache2conf

Open up httpd.conf with your favirote text editor and:

3A Search For:
Options Indexes FollowSymLinks

Replace With:
Options Indexes FollowSymLinks MultiViews +Includes

3B Search For:
AllowOverride None

Replace With:
AllowOverride All

3C Search For:
DirectoryIndex index.html index.html.var

Replace With:
DirectoryIndex index.html index.html.var index.htm index.php index.shtml

3D Search For:
<Directory "C:/Apache2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

Replace With:
<Directory "C:/Apache2/cgi-bin">
AllowOverride All
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

3E Search For:
AddType application/x-tar .tgz
AddType image/x-icon .ico

Replace With:
AddType application/x-tar .tgz
AddType image/x-icon .ico
ScriptAlias /php/ "c:/php/"
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
Action application/x-httpd-php /php/php.exe

3F Search For:
#AddHandler cgi-script .cgi

Replace With:
AddHandler cgi-script .cgi .pl

3G Search For:
#AddOutputFilter INCLUDES .shtml

Replace With:
AddOutputFilter INCLUDES .shtml

Jump down to step 7A to test and verify apache is working.

STEP 4: Download and install Perl:
http://activestate.com/Products/Download/Download.plex?id=ActivePerl ActivePerl 5.8.0 build 804 Windows MSI 11.5MB. Click on the Perl installation file you downloaded and accept the license agreement and continue until you come to the screen that says:

Custom Setup
Select the way you want features to be installed
Click the browse button and change the location from:
C:Perl
to:
C:usr

Click Next --> Click Next --> Click Next --> Click Install -->Wait for it to install --> Click Finish

Jump down to step 7B to test and verify Perl is working.

STEP 5: Download and Install PHP
http://www.php.net/downloads.php Scroll down until you see Windows Binaries. Download the latest stable zip version and not the installer version. PHP 4.3.0 zip package.

Unzip it to your: C: directory

Browse to your: C: directory and look for the folder named php-4.3.0-Win32. This maybe be different if you downloaded a different version.

Open up the php.ini-dist file located in the php-4.3.0-Win32 folder and:
Search For:
doc_root =

Replace With:
doc_root = "C:Apache2htdocs"

Search For:
extension_dir = ./

Replace with:
extension_dir = "c:phpextensions"

Save the php.ini-dist file and rename it to: php.ini

Now move the php.ini file into your: C:Windows directory.

Find the php4ts.dll file located in your: C:php directory and move it to your: C:Windows directory.

Rename the: C:php-4.3.0-Win32 folder to: php

Jump down to step 7C to test and verify PHP is working.

STEP 6: Download and Install MySQL
http://www.mysql.com/downloads/download.php?file=Downloads/MySQL-3.23/mysql-3.23.54-win.zip

Unzip the file you just downloaded to a temporary directory. If your using a program such as Winzip and it gives you the option to install now go ahead and do that and choose all the default settings.

If not browse to the temporary directory where you unzipped the files and click on the setup.exe file to start the installation. Continue through the installation with all the default settings until your done.

Jump down to step 7D to test and verify MySQL is working.

STEP 7: Test Everything:

7A: Test the Apache Web Server
Start Apache
You can start apache by going to the Start Menu -- > Apache -- > Start apache in console on Windows 98. This may be different for other versions.

You'll see a little Dos like screen appear if your using Windows 98

Open up a text file and throw some HTML in it:
Example:
<html>
<body>
Apache Web Server Test
</body>
</html>

Save it as index.html in your C:Apache2htdocs directory.

This is where all your html, graphics, and php files will go.

Go to http://127.0.0.1 or http://localhost in your favirote browser and see if it works.

Note: You can stop apache on Windows 98 by double clicking in the little black dos box and Pressing Ctrl+C


7B: Test Perl / CGI
Open up a text file and place some code in it:

Example:

#!/usr/bin/perl
print "Content-type: text/htmlnn";

print "Hello Perln";

Save it into your C:Apache2cgi-bin directory as: perltest.cgi

Go to http://127.0.0.1/cgi-bin/perltest.cgi and see if it works.


7C Test PHP:
Open up a text file and add the the following code to it:
<?php
phpinfo();
?>

Save it in your C:Apache2htdocs directory as phpinfo.php

Browse to:
http://127.0.0.1/phpinfo.php and see if it works.


7D Test MySQL:
Browse to your C:mysqlbin directory and Click on the winmysqladmin.exe file.

This should launch a graphical user interface that you can use
to edit configuration files, and maintain and monitor your MySQL server.

You should see a screen with:
Create the mysql.ini file with default values and the user below. Reccomended to novice user. Enter a username and password that you will remember Click Ok.

You'll see a stoplight icon in your taskbar

You can stop the MySQL server and/or the WinMySQLAdmin tool by right clicking on the icon.

To login to the MysQL server from the command line:

Go to the Start menu -- > selct run.
Type dosprmpt in the input box to open up the command-line interface, or if that doesn't work try typing cmd in the input box.
That should open up a dos like screen.

Change your directory to the bin directory of MySQL by typing:

cd c:mysqlbin

And pressing enter.

Now you can type mysql and press enter to start the MySQL monitor. You should see something like:

Welcome to the MySQL monitor. Commands end with ; or g. and some more stuff. If you see that then you know MySQL is working.

You can use the MySQL administration tools like mysqladmin and mysqldump from the command-line to create, drop, dump, and restore databases and alot more.

To get a complete list of mysqladmin commands type the following at the prompt:

#prompt> mysqladmin --help


If you plan on running scripts that connect to a MySQL database you usually need to enter a database name in the config file of the script. If you just make up a name and run the install file for the script, it may create the database for you. If not you can either use the database name: test, or create one using the mysqladmin tool.

You don't need to enter a username or a password in the config file. You can use localhost as the database hostname or server name.

Okay that's all for now, I'll try and update this tutorial every so often, so keep checking back for updates!. :)
 
Last edited:
2
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
a very informative thread.
 
0
•••
Search and find a book "apache 2 bible",you will get what you want ,really easy.
 
0
•••
Is this thread for Phpbb also?
 
0
•••
achacko said:
Is this thread for Phpbb also?
It has nothing to do with phpBB.
 
0
•••
You can use APPSERV (which has apache, php, mysql, phpmyadmin and now myodbc) http://www.appservnetwork.com/

its basically all of those tools wrapped up into 1 easy install. Perl isnt included though, but you can get that from activeperl. Not sure why they now include myodbc, but its in it.
 
0
•••
Very good tutorial :)!?!?!
 
0
•••
I get The following when I install perl

Code:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email][email protected][/email] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.


--------------------------------------------------------------------------------

Apache/2.0.55 (Win32) Server at 127.0.0.1 Port 80

I installed in G:\ instead of C, could this cause issues?

Edit: I now see that the rest of the tutorial requires my installation to be in C:/ What changes do I need if I want to install this in a different drive named G:/ ? I see that I need windows files andch, but I want to install this on a blank hard drive so it will require a bit more work for hackers.

Also, the file/folder phpextensions does not exist...
not does the file/folder mysqlbin...
Thanks
-Ambrose
 
Last edited:
0
•••
0
•••
No this tutorial is not quite up to date at the moment.
 
0
•••
I am currently downloading the files and will tell after I use this method. Post is indeed very informative.
 
0
•••
I'm sorry but I am kind of coming in at the tail end of this thread. I have only read a few posts here but I wanted to comment anyways because I am familiar with this....

I use this as a test server on my pc and I use it to work on many of my sites. It is so easy being able to just save a file and see the changes immediatly without having to upload....

I would reccomend downloading the whole package. I am sorry but I don't have the link or anything but it is very easy to install and use.... This is a great tutorial but if anyone has further problems I woulkd be happy to help. I use this on a daily basis....

You can ask here or at my forums here...

Thanks
 
0
•••
It works with me, but I noticed that moe easy way to get apache with all that is just Xampp. I dont need any tired of that work, just install xampp and its ok.
 
0
•••
WOW! this is awesome. I've been looking for a good, simple, and easy tutorial on installing a webserver for sometime now. ;)
 
0
•••
Cool piece of work.

Thanks for the helpful info!!
 
0
•••
useful thread :) rep added :music:
 
0
•••
Thanks for sharing.

I've been looking for something like that! Nice info here!
 
0
•••
Yeah, great thread. I have been using the bundled version for awhile on a pc in my basement that serves as a test server... Works perfectly.. I was thinking about trying linux but so far I stick with what I know....

Thanks for the info :)
 
0
•••
another good bundled version is wampserver www.wampserver.com
comes with php and apache and mysql.

also has systemtray menu to control the server.
 
0
•••
Can i use sockit software to configure Apache server?
Is it reliable?
 
0
•••
Here is a list of a few tutorials I have written on the subject,
hope they come in helpful to someone :)

Apache Articles
 
Last edited:
0
•••
It's very informative. Thanks.
 
0
•••
Check out xxamp if want easy solution
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back