Sei sulla pagina 1di 5

Steps to Installing and Configuring Apache 2 for Windows XP

1. Download Apache 2 (.msi)


2. Run the Apache Installer
Leave the default setting of "for All Users, on Port 80, as a Service" as it is. Click "Next" when you're
done.
3. Enabling and Disabling the Apache Service
go to Control Panel -> Administrative Tools -> Services, look for the "Apache2" service and double-click
it
4. Changing the Server Name and Administrator's Email Address
Start -> Programs -> Apache HTTP Server -> Configure Apache Server -> Edit the Apache httpd.conf
Configuration File.
Search for the following text and replace the "localhost" with the name you want.
ServerName localhost:80
Likewise if you want to change the Administrator's Email Address that you entered earlier, look for a
line like the following:
ServerAdmin admin@localdomain
Line 179, set the root:
DocumentRoot "D:/WebPages"
and line 204:
<Directory "D:/WebPages">
5. Configuring Apache to Accept Server Side Includes (SSI)

If you want the web server to parse Server Side Includes (SSI directives), search for the text "server-
side includes" in the file. Add the following lines just after the block of text containing those words:

AddType text/html .shtml


AddOutputFilter INCLUDES .shtml

Alternatively, you can uncomment the example text given in the configuration file by removing the
hash prefix ("#") before each line.

Apache will now handle the SSI directives that occur in files with names ending in ".shtml".

If you want "index.shtml" to be your default start page for your directories, ie, if you want Apache to
load "index.shtml" when you type "localhost" or "localhost/directory/", you will need to search for a line
in your "httpd.conf" that begins with "DirectoryIndex" and add index.shtml to the list of files there. For
example, modify it as follows:

DirectoryIndex index.shtml index.html

Adding it before index.html means that Apache will give preference to index.shtml if both are present.

6. Save the Configuration File and Restart Apache

When you are satisfied with your changes, save the file - just use the "Save" item from the "File" menu
or type Ctrl+S. After you make a configuration change, you need to restart Apache. To do this, go to
the Start Menu and click the "Restart" item in the "Control Apache" folder, that is, select Start ->
Programs -> Apache HTTP Server -> Control Apache Server -> Restart.

Setup phpMyAdmin
Step1.
Unzip the content of this file to C:\server\Apache2\htdocs and rename the file to phpMyAdmin

Step2.
Open the phpMyAdmin folder and find the "config.sample.inc.php" and rename the file to
"config.inc.php" as the picture show below:

Step3.
We need to edit the "config.inc.php" file so we will use Notepad C++ and find the line
"blowfish_secret" and add any word or nick name in my case I use 'myserver' and save the file.

Step4.
Open your browser and type the following line in http://localhost/phpMyAdmin/ and Enter.
Now there is a login screen so type in your username and password and press go.

Install PHP5.2

The VC6 build is for using the standard Apache server and the Thread Safe versionshould be use to
install PHP with this Apache module.(PHP 5.2 (5.2.17)

Step1.
Unzip the content of this file to C:\server\php.

Step2.
You must include the path to the PHP dll's in your Windows PATH environment variable.

Go to Control Panel
Open "System" then the "Advanced" tab

Click the "Environment Variables" button


In the "System Variables" list, click "Path" then click "Edit"

Add the directory where the PHP dll's can be found. Copy and paste the following ;C:\server\php
Important make sure you start it with semicolon and to use back slashes. Click OK three times and
you're done.

Step 3.
There is more changes to do before we finish the installation.
Go to C:\server\php and find the php.ini-recommended. Rename this file to php.ini.

Open this file with notepad and make the following changes.

Find the line with extension_dir = "./" and change it to:


extension_dir = "C:\server\php\ext"

Find the line with ;session.save_path = "/tmp" and change it to:


session.save_path = "C:\server\tmp"
also uncomment the line by removing semicolon ; at the beginning.

Find the line with short_open_tag = Off and change it to:


short_open_tag = On

Windows Extensions:(.dll)
Please also uncomment the lines by removing semicolon ; at the beginning of the Windows Extensions
of the as needed, please do not use all extension.
The most used extensions for most php scripts are:
;extension=php_curl.dll
;extension=php_mbstring.dll
;extension=php_exif.dll
;extension=php_gd2.dll
;extension=php_mcrypt.dll
;extension=php_mysql.dll
;extension=php_sockets.dll

Please note enable both the php_mbstring.dll and php_exif.dll DLL's in php.ini. The php_mbstring.dll
DLL must be loaded before the php_exif.dll DLL so adjust your php.ini accordingly.

Step 4
To find out if our PHP is working, from the start menu - run and type cmd. In the command prompt
window type php -v. The outcome will be something like this.

Apache Configuration:-
We need to edit the httpd.conf in C:\ server\Apache\conf to make sure that Apache knows where to
search for php modules.

1. - So make a backup copy of httpd.conf and edit the original file with notepad by adding the
following lines at the end.

LoadModule php5_module "C:/server/php/php5apache2_2.dll"


PHPIniDir "C:/server/php/"
AddType application/x-httpd-php .php

2. - Find this line in httpd.conf.


DirectoryIndex index.html
and add:
DirectoryIndex index.html index.php

3. - Find this line in httpd.conf.


<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from None
</Directory>

Change this to:


<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

4. - Find this line in httpd.conf.


# AllowOverride controls what directives may be placed in .htaccess files.

# AllowOverride controls what directives may be placed in .htaccess files.


# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

Change this to:


AllowOverride All

5. - Find and remove # at the beginning from the following lines


#LoadModule rewrite_module modules/mod_rewrite.so
#ServerName localhost:80

6. - Now create a file php phpinfo, so open notepad and add the following in the text field:
<?php phpinfo(); ?>
and save as - File name: phpinfo.php save as type: "All Files" in Notepad or in your favorite php
editor.

Place this file in the root of your server C:\server\Apache2\htdocs.

You can delete the index.htm file in this folder. All your projects will be pace in this folder.

Well that is it we setup now PHP in windows.

Please bookmark this web page as we going to reboot windows; we still have to install MySQL by
press Ctrl + D on your keyboard

After you reboot windows open your browser and type the following line in
http://localhost/phpinfo.php

You should see now a PHP information page like this:

PHP 5.3.X reporting some errors in the time zone has not been defined:
To solve the problem you can disable the new error by setting the "error_reporting" to a value of
"E_ALL & ~E_DEPRECATED" in line 514 or 515 in the php.ini, after the change please restarting
Apache.

The php.ini line should look like this:

Install MySQL

I will not list all the steps but the most important.

On the downloaded MySQL double click and this will start the installation of MySQL and follow the
instructions.

Select "I accept terms in the licence agreement" and click next: -

select the "custom" icon to change the path of the installation.

Now browse or navigate to the folder C:\server\mysql we want to install the files in this folder.

After the change press ok.

Press install.
Select a standerd configuration press next.

To install the mysql service, press next.

We need a password for MySQL database please enter a password, please remember the login name
in most cases is root and the password your choosing, in my case I chooseadmin471.

It will execute all the commands we enter so press "execute"

Now MySql database is finally installed.

The final and last step is you need to do is to open php.ini file located in C:\server\php and
uncomment the line.
extension=php_mysql.dll
by removing semicolon ; at the beginning. Save the file and close it.

Restart the apache server by clicking on the apache icon in your taskbar.

Useful tool is MySQL administrator and system tray monitor from MySQL GUI and you can
download it from there website.

Setup Mysql GUI:-


Go to programs menu (MySQL) click on "MySQL Administrator" Login into your database as localhost -
username and password go to "service control" and click on the tab "configure service" and change
the path of the my.ini file to the correct location:
C:\server\mysql\my.ini and click apply.

Running MySQL in command prompt:


All commands are run from the command line and directory - "C:\server\mysql\bin\
To stop MySQL Running:
NET STOP MySQL
To start MySQL Running:
NET START MySQL
Uninstall the MySQL Service:
"C:\server\mysql\bin\mysqld" --remove

Potrebbero piacerti anche