IT is Fun

August 7, 2007

Set up Apache, PHP and MySQL

Filed under: ETC — themamakcorner @ 3:06 am

Below are instructions to set up your machine for PHP environment. I’m using Windows XP Professional SP2.

(1) Apache Web Server

Download the Win32 Binary (MSI installer). Double click on the downloaded installer and install. The version I’m using is Apache 2.0.59 and I installed into C:\Program Files

Apache installation wizard

(2) PHP Run-time

Download PHP. I’m using PHP 5.0.2 . Install it to C:\php.

PHP setup wizard

(3) The next step will require you to copy these 3 files from C:\php to C:\Program Files\Apache Group\Apache2

(a) php5ts.dll

(b) php5apache2.dll

(c) php.ini

(4) Open php.ini in C:\Program Files\Apache Group\Apache2 using any text editor. Find “doc_root” and edit it to

doc_root = C:\Program Files\Apache Group\Apache2\htdocs

(5) Go to the directory: C:\Program Files\Apache Group\Apache2\conf\ and open httpd.conf file for editing. Add those lines at the end of the file.

LoadModule php5_module php5apache2.dll

AddType application/x-httpd-php .php

(6) In the same file, look for “DirectoryIndex” and edit it to

DirectoryIndex index.html index.html.var index.php

(7) START THE SERVICES

Start the service and the service icon will appear.

(8) TEST APACHE WEB SERVER

After all the installations are done, all you haev to do is to test them out. Open your browser and type http://localhost/ or http://127.0.0.1/ The page will display test page for Apache.

(9) TEST PHP

Go to C:\Program Files\Apache Group\Apache2\htdocs, create a new PHP file using notepad.

Save the file as “test.php”

Write the following codes in the PHP file and save it:

<?php

echo “testing for PHP”;

?>

Open a new browser and type http://localhost/test.php

If your browser display the same, it means that you have succesfully set up the Apache and PHP.

AN EASIER WAY TO SET UP

If you find that installing Apache web server, PHP and MySql seperately give you lotsa headache, you can always try to install EasyPHP. It consists all the installation with just a click.

EasyPHP setup wizard

Install it to C:\

Then try to create a test php page (just like the one I created earlier. Place it at www folder.

Start the service.

Open a new browser and type http://localhost/test.php

If your browser display correct page, thus, you’ve successfully installed EasyPHP.

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.