WeblinkIndia logo
+91-9319740538 Get a Call BAck

Configuring PHP 5 With Apache 2 On Windows

Web Development | Admin | Last Updated: 2011-01-31

Configuring PHP 5 With Apache 2 On Windows

PHP or Pre Hypertext Processor is the one of the most used languages that has revolutionized the way programmers are developing websites. Running PHP on the Apache server helps you to run tests on a live environment and take any actions if required. This write-up guides you step by step on configuring PHP 5 with Apache 2 on Windows system, starting from installation to offering other alternatives as well.

  • To use PHP on Windows with Apache, you should install the 2.2.x version on your system. To check if it has been installed- type http://localhost on the address bar of the browser and if the Apache Page appears, then it is confirmed.
  • Extract the PHP 5 folder in the C drive and rename the file php.ini-recommended as php.in.
  • Open the 'conf ' folder after going to the Apache directory. Modify 'httpd.conf ' and after that find LoadModule to replace it with the following :
    • For Apache 2.2.x: LoadModule php5_module "c:/php/php5apache2_2.dll"
    • For Apache 2.0.x: LoadModule php5_module "c:/php/php5apache2.dll"
  • In Apache 2.2.x, search the section for "AddType" lines and add this line right before the section closing.
    • AddType application/x-httpd-php .php
  • Add the following line anywhere in the file to let the server run the PHP executable every time a PHP script is encountered. Either add it in the comment block for Action or in case of Apache 2.2.x, you can add it after the AddType statement.
    • Action application/x-httpd-php "/php/php-cgi.exe"
  • Modify DirectoryIndex index.html to DirectoryIndex index.php index.html.
  • Start the Apache web server again.
  • Create a PHP file having the following line and save the file in the root directory of the server with the name test.php.
  • Now run Apache and open http://localhost/test.php (If you were able to configure successfully, then PHP information page is displayed or else the line is seen in the browser as text. In that case you can check the problem with the CommandPrompt window by running php-cgi.exe and the following line:
    • c:phpphp-cgi test.php

Another option is to use PHP Triad or WampServer, where configuring PHP and Apache is not required. If you can download the software then you get built-in support for MySQL, Apache and, PHP. Then you just need to install them and run.

Add a Comment

Your email address will not be published. Required fields are marked *

Recent Posts

Why you must add top 5 WordPress Contact Form Plugin? [thumb]

Why you must add top 5 WordPress Contact Form Plugin?

Web Development | Jun 03, 2021

WordPress is a CMS that doesn’t require a formal introduction. It is a widely popular CMS utilized worldwide. Right f...

Read Full Story


Why Developers Choose PHP for Web Development? [thumb]

Why Developers Choose PHP for Web Development?

Web Development | May 26, 2021

 The Covid-19 pandemic assured us that a majority of businesses can function online better. That’s a key reason for t...

Read Full Story


Which One is better WordPress Or Drupal? [thumb]

Which One is better WordPress Or Drupal?

Web Development | May 17, 2021

Are you struggling to understand the difference between WordPress and Drupal? You may have seen plenty of WordPress h...

Read Full Story