Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Setting up Apache on XP


Setting up Apache on XP

By ghostghost | 4057 Reads |
0     0

=[ Setting up a server on a windows box with Apache ]—

To understand what we are doing you should have some basic knowledge of networks, computers and internet. I will try to explain everything on my best, if I miss something please correct me.

— What we need is — -> Windows XP/NT with TCP/IP protocol installed -> Apache 2.x -> PHP5 –recommended -> MySQL –recommended The last two are not vital in setting up a server, but I recommend downloading them too. So let's get started! First we'll download Apache. (the latest stable version is: 2.2.3)

— Installing Apache HTTP Server — -Launch http://www.apache.org -HTTP Server -Download from a mirror -Win 32 Binary (MSI Installer) If you have problems downloading it, try a different mirror. After you have downloaded it launch the setup. In the Server Information window fill these in: -Domain name: localhost -Server name: localhost I recommend you installing it as a service. Later I'll show you how to disable the autostart. Let's assume you have it installed in 'c:\program files\Apache software foundation\'. And now we'll configure it to run properly! Now you can run Apache either from command line, from [start]->[Programs]->[Apache HTTP Server]. So you have it installed as a service and you don't want it to run every time you boot up. Go to [control panel]->[Administrative services] ->[services],right click on [Apache]->Properties->startup type->manual. Click [OK] and close it. Run your Apache server: c:\program files\Apache software foundation\bin\ApacheMonitor or from the tray bar. Open up your browser, and type in http://localhost/ or http://127.0.0.1/ if this won't work we are going to configure it.

— Configuring the Server — c:\program files\Apache software foundation\conf\httpd.conf open with notepad And edit these lines: Listen 80 -> 8080 // this is the port on which you'r server will listen ServerName localhost:80 -> localhost:8080 // the domain name Save the changes, and try http://localhost:8080/ or http://127.0.0.1:8080/ in your browser. If you see a 'It works!' heading you're done. If you see some kind of error, check: http://httpd.apache.org/docs-2.0/platform/windows.html or search the bug with google. View the error log: c:\program files\Apache software foundation\logs\error.log Ask on a forum, or try doing it again. If you have it running let's continue with PHP5.

— Installing PHP5 — -Launch http://www.php.net -downloads -Windows binaries -latest .zip package After you have downloaded it extract it somewhere, let's say c:\php -rename php.ini-dist to php.ini then copy it to you'r windows folder: c:\windows As you can see there is another ini file php.ini-recommended. The dist is used for developement and the other is used for the real server. ( there's difference in the error reporting and things like that). -copy php5ts.dll to c:\windows\system32 And we are done with the installation.

— Configuring PHP5 as an Apache module — c:\program files\Apache software foundation\conf\httpd.conf open with notepad And edit these lines: find 'AddType' and append these lines after it: AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps

find 'LoadModule' and append this line: LoadModule php5_module "c:/php/php5apache2.dll" // forward slashed!!! and be sure the path is correct

— Testin' it!!! — Now create a file test.php:

and place it to c:\program files\Apache software foundation\htdocs this is your server's root directory, it can be changed in the httpd.conf To easily change it replace all occurences of it with the new root directory. Now launch http://localhost/test.php ( and good luck :) If it works you're lucky! If not try out all the dll's (in the LoadModule directive) which start with php5apache in c:\php or check the error.log. The one that worked for me is php5apache2_2.dll

— End — That's all. From this point you should read the Apache documentation, google, wikipedia … Maybe I'll write another articles on this topic, like adding MySQL, config directives, .htaccess files and things like that. I hope you enjoyed this article. And if you have any problem installing Apache, remember that you have the WEB!!!

Comments
ghost's avatar
ghost 18 years ago

markup<?php phpinfo(); ?> is a good test

ghost's avatar
ghost 18 years ago

Apache 2.0.59 is easier to configure with PHP than 2.2. Also, get Zend Optimizer at zend.com to speed up php applications