(Installing Apache PHP and MySQL) Today I’m going to share a few tutorial on how to make a webserver, a local web server precisely. the server will have (http://localhost) as the address. Of course we are going to use Windows/OS, not linux. This localhost will bring more help for the webmaster who wanto develope a PHP aplication. So this page will only cover the WAMP ( Windows, Apache, MySQL, PHP ) plus phpmyadmin script, to be able to manage the database later on.So then lets begin, What will I for it? You will need
- Apache, you can download it for free here
- PHP, you can download it here
- MySQL, you can download it here
NOTE: I’m Using all the lates vesion for apache 2.2, PHP 5, MySQL 5. but in here I’m recomanded you use apache 2.0, php 4, and MySQL 4. cause I think its more simple an easy to do it. But dont worry if you understand the way it work, you can upgrade it later.
The first step is install the apache, or build an apache server
Installing apache is easy if you download the Microsoft Installer ( .msi ) package. Just double click on the icon to run the installation wizard. Click next until you see the Server Information window. You can enter localhost for both the Network Domain and Server Name. As for the administrator’s email address you can enter anything you want.
I’m using Windows XP and installed Apache as Service so everytime I start Windows Apache is automatically started.
Type :
- Network domain : localhost
- Servername : localhost
- Administrator email : admin@localhost

Then click the Next button and choose Typical installation. Then click Next one more time and choose the location where you want the apache to install ( for me, I installed it in the default location C:\Program Files\Apache Group ). Then click the Next button and then it will complete the installation process.
Now to know that you have successfully install the Apache. Open up your favorite browser and type http://localhost in the address bar. You should see something like this (or similar to it) :

By default Apache’s document root is set to htdocs directory. The “document root” is the location where you must put all your PHP or HTML files so it will be process by Apache ( and can be seen through a web browser ). Of course you can change it to point to any directory you want. The configuration file for Apache is stored in C:\Program Files\Apache Group\Apache2\conf\httpd.conf ( assuming you installed Apache in C:\Program Files\Apache Group ) . It’s just a plain text file so you can use Notepad to edit it.
For example, if you want to put all your PHP or HTML files in C:\www just find this line in the httpd.conf :
DocumentRoot “C:/Program Files/Apache Group/Apache2/htdocs”
and change it to :
DocumentRoot “C:/www”
After making changes to the configuration file you have to restart Apache ( Start > Programs > Apache HTTP Server 2.0.50 > Control Apache Server > Restart ) to see the effect.
Another configuration you may want to change is the directory index. This is the file that Apache will show when you request a directory. As an example if you type http://www.php-mysql-tutorial.com/ without specifying any file the index.php file will be automatically shown.
Suppose you want apache to use index.html, index.php or main.php as the directory index you can modify the DirectoryIndex value like this :
DirectoryIndex index.html index.php main.php
This is for whenever you request a directory such as http://localhost/ Apache will try to find the index.html file or index.php or main.php.
Installing an configuring PHP
First, extract the PHP package ( example like this : php-4.3.10-Win32.zip ). I extracted the package in the directory where Apache was installed ( C:\Program Files\Apache Group\Apache2 ). Change the new created directory name to php ( just to make it shorter ). Then rename the php.ini-dist to php.ini. Copy it to your Windows directory ( C:\Windows ). This is the PHP configuration file and we’ll take a look what’s in it later on.
Then, copy the php4ts.dll file from the newly created php directory into:
- sapi folder in your phpdirectory.
- In the directory where apache.exe is start from ( C:\Program Files\Apache Group\Apache2 \bin)
- In your %SYSTEMROOT%\System32, %SYSTEMROOT%\system and %SYSTEMROOT% directory.
Note: %SYSTEMROOT%\System32 only applies to Windows NT/2000/XP)
Now, Telling Apache that you have install PHP
Because Apache doesn’t know that you just install PHP. So lets tell Apache that we have install PHP. How to do this? very simple. Open the configuration file in C:\Program Files\Apache Group\Apache2\conf\httpd.conf and add the following three lines :
LoadModule php4_module php/sapi/php4apache2.dll
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
After you we do that, Now its time to restart the apache server to take effect
Now Let’s see, if we successfully tell the Apache about the PHP. Create php files. For the example this time I use (test.php). Then write this code in it.
phpinfo();
then put the file in your “localhost location” (C:/www), and execute with your browser.so it will look like this:

Now It’s time for the MySQL
First extract the package ( for example : mysql-4.0.18-win.zip ) to a temporary directory, then run setup.exe. Follow all the instruction the easy way to do it, its just keep clicking the next button and fill the password for your database to complete the installation. By default MySQL will be installed in C:\mysql.
so your database
- host will be “localhost”
- username will be “root”
- password will be “the one that you enter in the installation process”
- for your database name “you can use phpmyadmin to help you” (just download the script and follow the instruction)
thats all for MySQL, Note: if you want to use New MySQL v5, please use PHP 5 for this.
For those of you, that don’t want mess around with all these you can always try the other way. thanks to the people who kindly enough to make the bundle of apache+php+mysql. for example phpdev and many more out there, this kind of software can be found in sourceforge.net just Search for keyword “WAMP”( WAMP/ Windows Apache MySQL PHP ) or “PHP/Apache/MySQL”.
Hope that can help you to developed some nice PHP application. thanks for your time on reading this.
Posted December 19th, 2006 by admin This entry was posted on Tuesday, December 19th, 2006 at 10:34 am and is filed under Uncategorized. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

















Leave a Reply