CARI Infonet

 Forgot password?
 Register

ADVERTISEMENT

View: 4276|Reply: 10

Step-by-Step: Installing Apache 2.0.35 for Windows

[Copy link]
Post time 23-2-2004 05:10 AM | Show all posts |Read mode
This guide will go over installing Apache 2.0.35 on a Windows system. To get the installation file, go to http://www.apache.org and look for their http server. More information about the windows version of Apache can be found here: http://httpd.apache.org/docs/windows.html.

Download the files here: http://httpd.apache.org/dist/httpd/binaries/win32 The file I am showing here is called: apache_2.0.35-win32-x86-no_ssl.msi Here we go.

Double click on the downloaded file to begin installation.
You'll see this welcome screen.  Click "Next".


Next you'll see the License Agreement.  Check the "I accept" radio button and click on "Next".


Another screen appears with more information about what Apache HTTP server is.  Click "Next".


The configuration now begins.


In this example, I'll use my own information to fill in the blanks.  The last part of this window asks if you want to run Apache for all users as a service or for just the current user.  Since we want Apache to run as a webserver for everybody, we select the first option "All Users".  Click "Next".


Here we choose whether to install as Typical or Custom.  Typical sounds good to me.  It should also be fine more most people.  Click "Next".


Now we choose where we want to install Apache.  You can change this by clicking on the "Change" button and selecting whichever directory you like.  Here we'll keep it default.  Click "Next".


To begin installation click "Install".


You'll see this fun blue bar start running (or crawling) across your screen.  Just sit tight.


After some disk churning, you'll see that the "Installation Wizard Completed".  Click "Finish".


Wow, we're done.  Sorta.  You see that little new icon in your system tray?  That shows you the status of Apache.


Let's see if Apache works now.  Fire up your web browser and type in "http://localhost" or "http://127.0.0.1" and see if you get the default Apache page.  You should see this.


There we go, another smooth installation.

[ Last edited by Remy_3D on 23-2-2004 at 07:37 AM ]
Reply

Use magic Report


ADVERTISEMENT


 Author| Post time 23-2-2004 07:30 AM | Show all posts

Changing the document directory

Here we'll cover some basics on configuring Apache.  Apache is configured by a very large file called "httpd.conf".  In this file are the instructions for how Apache behaves.  Much of the file are comments which are not processed by the server.  All lines with comments start with the pound symbol "#".  The lines that actually take effect do not have the pound symbol at the beginning.  The comments give you a good idea of what each line in the configuration file does.  It may be a good idea to just print out the whole "httpd.conf" file and study it and all the different parts.

Take a look at your "Start" menu.  Apache is now setup there.


First let's cover where you'll put your documents so that people can see them from the Internet.  To do this we'll look in the "httpd.conf Configuration file".  Go to "Start" --> "Programs" --> "Apache HTTP Server 2.0.35" --> "Configure Apache Server" --> "Edit the httpd.conf Configuration file".


A text file called "httpd.conf" pops up.


Use the "Find" function of notepad to search for "DocumentRoot".  You'll see this.


By default, all web documents will be stored in "C:/Program Files/Apache Group/Apache2/htdocs".   Let's test this out by creating a small file called "index.html" with the message "hello cruel world!" and putting it into this directory.  The reason we called it "index.html" is because that's the default document type for Apache.  When Apache finds a "index.html" file in a directory, it know to display this file first.  Go to your web browser again and type in either "http://localhost" or "http://127.0.0.1".  You should see our message.


Now, you can either keep this directory for all your web files, but personally I would change it to something in a less buried directory like "C:\webdocs" or something like that.  It's up to you.  All you have to do is change the path in the config file.  To illustrate, take a look at the picture where I changed the Document Root to "C:\webdocs".  Easy.


When you close the window with the configuration file with your changes, you'll see this message asking if you want to save your changes.  Click "Yes".


However, although you saved your changes, your changes are not in effect since the webserver is already running.  You must restart the Apache webserver for your changes in your "httpd.conf" file to take place.  You can do this easily by selecting "Restart" in the Apache program group.


Now that we've restarted our Apache server, let's see what happens when we go to "http://localhost".


Wow, what a large message.  Well, we get this message because we haven't created "c:\webdocs" nor created a default file.  Once I create the proper directory and default file, we get this.  That's much better (I think)


[ Last edited by Remy_3D on 23-2-2004 at 07:35 AM ]
Reply

Use magic Report

 Author| Post time 23-2-2004 07:39 AM | Show all posts

Configure Apache for PHP

This guide assumes that you have already installed PHP on your system.  If you have not yet done so, please take a look at this guide: Installing PHP on a Windows Webserver

Now that you've installed PHP on your server that is running Apache, you'll need to configure Apache so that it can utilize PHP properly.  In this example, we'll be configuring PHP on Apache 2.0.

First thing to do is to stop Apache.

Go to "Start" --> "Programs" --> "Apache HTTP Server" --> "Control Apache Server" --> "Stop".

You should get a message that Apache is stopping.

We now need to edit a file called "httpd.conf".  This file is located at "C:\Program Files\Apache Group\Apache2\conf".  Use any text editor such as Notepad to edit it.

Or another way you can edit httpd.conf is to go to "Start" --> "Programs" --> "Apache HTTP Server" --> "Configure Apache Server" --> Edit the Apache httpd.conf Configuration File".


We need to setup the ScriptAlias for PHP.  This creates a name for the directory where PHP is located.

Use the search function in your text editor and search for "ScriptAlias".  You'll find something like this:

---------------
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/"
---------------


Assuming that you followed the default installation of PHP and installed PHP into "c:/php/", then add the following line under "ScriptAlias"

ScriptAlias /php/ "c:/php/"

If you didn't install PHP into "c:/php/", then replace "c:/php/" with the directory into which you installed PHP.

-----------------
# ScriptAlias: This controls which directories contain server scripts.

# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/"
ScriptAlias /php/ "c:/php/"
-----------------


Basically we just connected "/php/" to "c:/php/".  So anytime the server encounters "/php/", it will be translated into "c:/php/".

Now let's work on "Action".  Use the search function in your text editor to find the phrase "Action lets you"

-----------------
# Action lets you define media types that will execute a script whenever
# a matching file is called. This eliminates the need for repeated URL
# pathnames for oft-used CGI file processors.
# Format: Action media/type /cgi-script/location
# Format: Action handler-name /cgi-script/location
#
-----------------


On a new line without a # add the following line:

Action application/x-httpd-php /php/php.exe

It should look like this:

-------------------
# Action lets you define media types that will execute a script whenever
# a matching file is called. This eliminates the need for repeated URL
# pathnames for oft-used CGI file processors.
# Format: Action media/type /cgi-script/location
# Format: Action handler-name /cgi-script/location
#
Action application/x-httpd-php /php/php.exe
-------------------


Now we have to let Apache know which files contain PHP code.
Use your search function to look for "AddType".

------------
# AddType allows you to add to or override the MIME configuration
# file mime.types for specific file types.
#
AddType application/x-tar .tgz
AddType image/x-icon .ico
------------


Add the line:

AddType application/x-httpd-php .php

It should look like this:

---------------
# AddType allows you to add to or override the MIME configuration
# file mime.types for specific file types.
#
AddType application/x-tar .tgz
AddType image/x-icon .ico
AddType application/x-httpd-php .php
---------------



Now, save the httpd.conf file and restart Apache.

Now we have to write a small php file to test out if PHP actually works.

Open up Notepad and paste the code between the two lines in the page.

----------------------------
<html>
<head>
  <title>PHP Test</title>
</head>
<body>
<?php echo "<p>Hello World</p>"; ?>
</body>
</html>
----------------------------

In Notepad, select "File" then "Save As".  Browse to your website document directory and save the file as "index.php".  Keep the "" marks.  This makes Notepad save the file with the ".php" extension instead of ".txt".


Now fire up your web browser and point it at the directory where you saved the file.  You should see this:


If you see the actual code of the page, then something is wrong.  You will need to go back and figure out what is missing.

Depending on your particular setup, you may or may not have to edit a file called php.ini.  This file is in your c:\windows directory.

That's it, your done!

[ Last edited by Remy_3D on 23-2-2004 at 07:45 AM ]
Reply

Use magic Report

Post time 22-5-2007 08:32 AM | Show all posts
hi...

TQ bebanyak coz tutorial ni memang betul-betul membantu..
ini 1st time saya install apache & php..
ikut tutorial ni and berjaya install..

tapi ada masalah sikit.. & nak tanya pendapat u
hope u dapat tolong..
after install apache & php, saya install mySQL..
tapi sekarang ni mySQL tak connect dengan php..
ada tak tips untuk settle masalah ni..
saya ada jgk search kat internet tapi buat masa ni tak jumpa lagi cara untuk settle masalah ni..
hope u boleh bagi pendapat..
ni kali pertama saya install mySQL..
TQ..
Reply

Use magic Report

Post time 24-5-2007 03:53 AM | Show all posts

Reply #4 jun_sk's post

bukak PHP.INI pastu uncomment mysql punya driver

Utk lebih mudah dlm setting Apache/PHP/MySQL ni, lebih baik guna pre-packaged ditribution, cthnya, WAMP... lagi senang, x yah pening2 kepala
Reply

Use magic Report

pijotfly This user has been deleted
Post time 27-5-2007 09:11 PM | Show all posts
EASYPHP pun nak install senang.. www.easyphp.org
Reply

Use magic Report

Follow Us
Post time 28-5-2007 01:05 AM | Show all posts

Reply #5 neotoxin's post


betul tu, senang guna wamp. tapi, kalau nak betul-betul belajar, install satu-satu and try make it work. the knowledge you get from it, priceless. i used wamp initially and very easy, but i don't learn a lot. when i tried install them one by one, i made lots of mistakes but i learned a lot too... and very satisfying when i resolved the mistakes. but, really, it's up to individual.
Reply

Use magic Report

Post time 29-5-2007 02:02 AM | Show all posts
better belajar cara nak install satu persatu... atleast tak la buta sangat kan...
lepas tu, lau dah faham..bleh la install memana integration like wamp ke easyphp ke...
Reply

Use magic Report


ADVERTISEMENT


Post time 29-5-2007 06:32 AM | Show all posts

Reply #8 mygirlz's post

heh.. I said it because I've done it. PHP on IIS6.0 with MSSQL (unusual combination isn't it?)
Reply

Use magic Report

Post time 29-5-2007 06:13 PM | Show all posts
ok tu memang ok...tapi tula..cara code lam windows binary ngan dalam linux environment berbeza..kekadang jalan kat windows..tapi lam linux...dia quite sensitip...lau iis ni senang nak mapping...lam apache lak berlainan..tapi terpulang kat individu la...mana yang senang...
Reply

Use magic Report

Post time 29-5-2007 08:23 PM | Show all posts
Originally posted by oobi at 28-5-2007 01:05 AM

betul tu, senang guna wamp. tapi, kalau nak betul-betul belajar, install satu-satu and try make it work. the knowledge you get from it, priceless. i used wamp initially and very easy, but i don ...


Yeah I agree with you.. Berguna masa buat troubleshooting, costumizekan feature & banyak lagi...
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

 

ADVERTISEMENT


Forum Hot Topic

 

ADVERTISEMENT


 


ADVERTISEMENT
Follow Us

ADVERTISEMENT


Mobile|Archiver|Mobile*default|About Us|CariDotMy

23-5-2024 05:25 PM GMT+8 , Processed in 2.202268 second(s), 37 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

Quick Reply To Top Return to the list