View Full Version : Installing Apache, PHP, and MySQL on Windows


sebluver
11-11-2003, 04:26 PM
First of all, I'd like to credit my wonderful PHP book, "PHP in Easy Steps" for teaching me how to do this first.

STEP ONE: Installing Apache

Go to http://httpd.apache.org. Download the latest file available for downloading for Windows, it will be named something like apache_1.3.29-win32-x86-no_src.msi . Double click on the downloaded file once you've downloaded it, and complete the server information so that it looks something like this:

Network Domain (e.g. somenet.com)
localdomain

Server Name (e.g. www.somenet.com)
localhost

Administrator's Email Address (e.g. webmaster@somenet.com)
youremailaddress@youremailaddress.com

When the Setup Type box appears, choose a complete installation. Then, in the destination box put where you want Apache installed, somewhere in your C:\ folder. Through experience, I've found out that you can install it practically anywhere. For example, mine is located in my Program Files, with the URL to get to it looking like this- C:\Program Files\Apache Group\Apache2. But it's probably easier to install it in a folder called Apache in C:\. Complete the installation, and you're done installing Apache! To test whether it worked or not, type http://localhost in your web browser. It should take you to the default Apache page.

Starting and Stopping Apache:
If you installed Apache with the choice to start and stop it manually (I don't recommend this, unless you want to), then it can always be started by typing NET START apache at a command prompt, and stopped by typing NET STOP apache at a command prompt.


STEP TWO: Installing MySQL

Go to http://www.mysql.com, and download the latest version of MySQL available for Windows. The file should look like mysql-3.23.49-win.zip . Unzip that file, then double click on setup.exe . Actually, the newest version of MySQL doesn't have setup.exe, but instead says to unzip it all into a file in you C:\ folder. As far as I've seen, this way works too.

Starting and Stopping MySQL:
MySQL can always be started by typing NET START mysql at a command prompt, and stopped by typing NET STOP mysql at a command prompt. Normally it will continually be running though in the background.


STEP THREE: Installing PHP

Download the newest available version of PHP at http://www.php.net . Unzip this file into a convenient location, such as C:\PHP . One of these extracted files should include one called php.ini-dist (or just php.ini). Copy this folder to your C:\Windows folder, and rename it to php.ini, if it's not already named that.


STEP FOUR: Configuring Apache for PHP

In your apache folder, go to the conf folder, and in that open up httpd.conf in a text editer. Find the section relating to the AddType instruction. (HINT: Just do ctrl+f and type in AddType until you get to the actual AddType code. The code should look something like this:
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz)

Below that, insert the following code:

AddType application/x-httpd-php .phtml .php .php3 .php4
AddType application/x-httpd-php-source .phps

ScriptAlias /php/ "c:/php/"
Action application/x-httpd-php "/php/php.exe"

Save the httpd.conf file, then restart apache to apply the changes.

Restarting Apache:
In Windows XP (don't know about others), you probably have an icon on your taskbar that you've never seen before. If you click it, you should have some options to restart it, stop it, and start it. Restart it, and then you're on to the next step!


STEP FIVE: Testing PHP

In a blank document, place the code <?php phpinfo(); ?>
Name the file phpinfo.php, and place it in your htdocs folder (in your apache folder). Go to http://localhost/phpinfo.php . You should get your PHP info.

There you go! No more tedious uploading of files to your site, all you have to do is save your files in htdocs, and you can access them at http://localhost . You can delete all of those index files that are there, they aren't needed, and that way you can access your files directly by going to http://localhost .

Have fun!

joshg678
02-29-2004, 10:22 PM
you can also go to that ipadress if you have a in-home network or in company network.
eg http://192.168.1.13
luckey 13 ;)