Вы находитесь на странице: 1из 4

Installing Apache

Well, let's locate that Apache exe file and run it. I hope you still remember where
you kept it.

Server Information
Network Domain:- StaticIP, local ip(192.168.0.1), yourdot.com
Server Name:- 127.0.0.1(localhost),Static DNS(no-ip.com), www.domain.com
Administators Email:- your_email@yourDomain.com

-Check for "All users -- Recommended"


-Select Typical
Finish the install.

Configuring Apache
Ok, now remember when apache install was on 'Server Information'? We specified
localhost as 'Server Name' or your local ip addy/dns.

Apache was configured just to run on default. So lets try it out.

For Win9x
Click on "Start->Programs->Apache HTTP Server 2.0.47->Control Apache
Server-> Start Apache in Console"

Apache launches a DOS window then the window is immediately renamed to


'APACHE'. Give it some time to load[patience]. In win98, the windows stays there...
so just minimize it.

WinXP after install apache should have automatically opened.

Now in any event during install you get an error mentioning apache was unable to
bind to 0.0.0.0:80, you will need to set apache to port 8080 since 80 is being used,
all explained
in the next block below.
-Open C:\Program Files\Apache Group\Apache2\conf
-Edit the file named httpd.conf
-Search for Listen 80 and change it to Listen 8080
-Save and Exit
-Click Start->Run, type cmd or command
Install apache service - retry
-In command prompt, browse to C:\Program Files\Apache Group\Apache2\bin
-Type apache -k install -n "apacheretry"
To start an installed Apache service
-Type apache -k start -n "apacheretry"

Now, we configured apache. Let's take it for a test. Open you're browser and type
http://localhost or http://localhost:8080
You should see this after you have typed the address:
'If you can see this, it means that the installation of the Apache web server
software on this system was successful.'

We will make a little index file for apache to use everytime you are in
http://localhost
Remember, we will not use the index file until apache is configured for the folder
web.

-Stop Apache. net stop apache in command or stop apache using the start menu.
-First, open the configuration file(httpd) - located in the 'conf' folder of Apache
-Search for DirectoryIndex then we will add little extra characters to that line.
-Unlike the image below, add index.php and index.htm after index.html.var

-Save and Close the file.


-Make a folder named 'web' under your main[c] drive.

Downloading PHP
PHP is a widely-used general-purpose scripting language that is especially suited for
Web development and can be embedded into HTML.

ok, another new day. Well, lets get into it. We need to download php but its a zip file
and its going to need winzip/winrar/pkunzip/unzip/whatever you have unzip it
inorder to use it.

Download PHP version [4.4.2] :: format: zip file :: size: approx. 7.9MB
lets unzip this file into the folder 'c:\php'
Note: When you unzip this file, it drops an extra folder.
C:\php\php-blah*. Move the contents of the second php folder to the
first one then delete that extra php folder that was created.

Configure PHP
Go into folder 'c:\php' find file 'php.ini-dist' rename it to 'php.ini'
Open the file 'php.ini' using 'Notepad'
Under 'Search' click 'Find' or 'Edit' click 'Find' on Windows 2000 or press 'Ctrl+F'
then type this 'doc_root' and modify according to the image below.
A few lines after, find 'extension_dir' and modify following the image below.

Modify the values of this two variables according to the screenshot below:

-Save and Close the file.


-Now, lets move this file to:
'php.ini' to c:\windows -- Win95/98/XP
To c:\winnt or c:\winnt40 -- WinNT/2000/XP

copy the file php4apache2.dll from c:\php\sapi folder to the apache.exe folder
By default C:\Program Files\Apache Group\Apache2\bin

also copy the file php4ts.dll from c:\php to the same apache.exe folder above

Configure Apache for PHP


Open the 'httpd.conf' file that we opened earlier configuring Apache.
"Start->Programs->Apache HTTP Server 2.0.55->Configure Apache Server-
> Edit the Apache httpd.conf Configuration File"

Search for 'DocumentRoot' & a few lines below 'Directory'


Modify the variables to match the following values:
Go to the line or search for '#AddType application/x-tar .tgz'
below that line add the following:
-You can cut and paste them.

# Load sapi module


LoadModule php4_module c:/php/sapi/php4apache2.dll
AddType application/x-httpd-php .php

-Save and Close the file.


-Restart Server(MUST).

Test PHP
Restart apache.
-Start Menu ::
Start->Programs->Apache HTTP Server 2.0.55->Control Apache Server-
>Restart
-Command shell :: apache -k restart -n "apacheretry

Lets go ahead and test php with a simple line.


Open Notepad by clicking 'Start' -> 'Run' then typing 'notepad'

Example script in new window.

Save the file under 'c:\web\test.php'


Open your browser and type this at the location box
'http://localhost/test.php' or 'http://localhost:8080/test.php'

That sample script displays the date

Вам также может понравиться