- Download Apache from this location http://apache.deathculture.net//httpd/binaries/win32/httpd-2.2.17-win32-x86-openssl-0.9.8o.msi
- Double Click on the installer and click "Next -> Next" to install via default setting.
- Now I do not want to use others to use my Apache Web server and hence to disable it from being used from outside I am going to limit the server availability to localhost. To do that goto C:\Program Files\Apache Software Foundation\Apache2.2\conf and open httpd.conf.
- Search for ServerName and Replace the line with ServerName localhost:80. This makes it only available via localhost.
- Also, change the value of ServerAdmin to ServerAdmin admin@localhost.
- Now restart the server via Start -> Programs -> Apache HTTP Server -> Control Apache Server -> Restart and open a browser and type http://localhost/. If everything works out well, you'll see the text "It works!".
- Download PHP installer from http://windows.php.net/downloads/releases/php-5.3.5-Win32-VC9-x86.msi location
- Double click on the installer to run it.
- In Webserver setup page select Apache 2.2.x module and hit next.
- Provide location of Apache configuration files location in my case it is C:\Program Files\Apache Software Foundation\Apache2.2\conf\
- Hit Next, Install and Finish to complete the installation.
- Now if you try to restart the server, it will fail. That's because the PHPIniDir and LoadModule values are wrong.
- So, change the following in the httpd.conf
- PHPIniDir "C:/Program Files/PHP"
- LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"
- Now restart the server. It should work.
- To check if PHP is working create a file hello.php at C:\Program Files\Apache Software Foundation\Apache2.2\htdocs
- Edit the file and add <?php phpinfo(); ?>
- Save it restart the server and open browser. Open url http://localhost/hello.php and you should see PHP related information.
short_open_tag - if you like <? better than <?php, you can edit C:\Program Files\PHP\php.ini and change short_open_tag = Off to short_open_tag = On. You can test it by changing hello.php. Replace <?php phpinfo(); ?> to <? phpinfo(); ?>. Save it and rerun from browser.
Default Index Page - for lot of php application the default page is index.php instead of index.html. So, it is recommended that you add index.php before index.html. Following line of code in httpd.conf should take care of that:
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
No comments:
Post a Comment