PDA

View Full Version : Set Apache2 with PHP 5 and mysql on windows XP Pro


pjdigital
01-18-2006, 12:27 PM
Hey gamers i have never written a tutorial before so i thought id have a go at so here we go

INSTALL Apache 2.0.55
Create a folder C:\WWW
This is where you will keep your web documents
Download the Apache Web server for windows from here
http://apache.mirror.pacific.net.au/httpd/binaries/win32/apache_2.0.55-win32-x86-no_ssl.msi
Have the installer install it to C:\Apache\Apache2
Enter localhost or your server name as the server and whatever for the email address
Choose as a service on port 80(recommended)
This service will automatically execute on startup you can change this to manual
If you like in the management console or use "net start Apache2" command
From the run menu

INSTALL PHP 5.1.2
Download PHP from here
http://www.php.net/downloads.php
Choose the Windows Binaries for download not the installer version

You Might also want the help files PHP has excellent documentation
http://www.php.net/download-docs.php

Create a folder C:\PHP5
Extract the downloaded PHP zip file to C:\PHP5

CONFIQURE APACHE
To Run PHP as an Apache Module we will change settings in the Apache config file
This method is best it’s faster and more stable

Open the file C:\Apache\Apache2\conf\http.conf with a text editor (notepad)
Any line that starts with hash # is commented out also note the conf file uses forward slashes Instead of back slashes for directory paths

In the LoadModule section add this entry this tells apache to load PHP as an apache module as opposed to running it as a separate application.
LoadModule php5_module C:/PHP5/php5apache2.dll

Now we need to tell Apache where to look for web documents

Find and change this entry
DocumentRoot "C:/Apache/Apache2/htdocs"
To this
DocumentRoot "C:/WWW"

Find and change this entry
<Directory "C:/Apache/Apache2/htdocs">
To this
<Directory "C:/WWW">


Find and change this entry
DirectoryIndex index.html index.html.var
To this
DirectoryIndex index.html index.htm index.php index.html.var
This is for the default document type so if you type in
http://localhost/
any file with those names will automatically be displayed

Find the Addtype Section and add the following entry
AddType application/x-httpd-php .php
This adds the PHP file type to the header so Apache can parse it

CONFIQURE PHP 5.1.2
Open the folder C:\PHP5
Rename or copy and rename
php.ini-recommended to php.ini

Copy these files from Your Php Install Directory C:\PHP5

libmySQL.dll – only needed if you’re going to use MySql databases
php.ini

To these directories
C:\WINDOWS\php.ini
C:\WINDOWS\libmySQL.dll

Open C:\WINDOWS\php.ini with a text editor (notepad)
anthing starting with ; is commented out
in the Paths and Directories section change the default values to the following
extension_dir = "C:\PHP5\ext"
doc_root = C:\WWW
if you want mysql support in the dynamic extension section uncomment
the following entry in other words remove the ; from the start of the line
extension = php_mysql.dll

this tells PHP where to find its dcuments and where to find its extensions
and to load the Mysql Extension for Mysql support

INSTALL MYSQL
Download from here
http://dev.mysql.com/downloads/mysql/5.0.html
Install to C:\mysql\
Run the admin tool C:\mysql\bin\winmysqladmin.exe
enter a username and password
I recommend you reboot after that and that’s it done

NOTE:
phpMyadmin is a very useful web based admin system for mysql
and can save you a lot of time creating and editing databases
http://www.phpmyadmin.net/
NOTE:
you may or may not have to alter permissions in winXP for C:\WWW and C:\PHP5