Installation of PHP and PHP.INI file

The PHP Installer

Although an installer is available from, I would recommend the manual installation if you already have a web server configured and running.

Manual Installation

Manual installation offers several benefits:

  • Backing up, reinstalling, or moving the web server can be achieved in seconds
  • You have more control over PHP and Apache configuration.

Next we will be installing PHP version 5. Follow the steps carefully.

  1. Go and download the "PHP 5.2.0 zip package" to your desktop. (Be patient while it downloads, the ZIP file is over 9MB!)
    Note: Make sure that you download the PHP 5.2.0 zip package!
  2. Create a new folder called "php" in your C Drive. Copy the "" file to there ("C:\php") and extract it using WinZIP or a similiar program like WinRar.
  3. Your "C:\php" directory should now look like:
  1. Next rename the "php.ini-dist" file to “php.ini” and copy it from "C:/php/" to "C:/WINDOWS". This is your PHP configuration file. Explanation on this file will be later.
  2. Now we are require to configure the PHP according to the web server we have installed.
  3. Configuration on Apache Web Server
  • Using Notepad openconf (should be start-menu shortcut "Apache HTTP Server 2.2 > Configure Apache Server > Edit the Apache httpd.conf Configuration File"). Either at the very beginning or end of the file add the following lines:

(NOTE: be sure to change BOTH C:/php parts to the directory you installed your php to)

     LoadModule php5_module "C:/php/php5apache2_2.dll"    

     AddType application/x-httpd-php .php    

     PHPIniDir "C:/php"


Note: If you installed the older Apache 2.0, instead of the above lines, you will need to use the lines listed on the bottom step of the Apache 2.0 tutorial.

  • [Optional]To get Apache to automatically look for an index.php, search httpd.conf forDirectoryIndex (about line 212) and add the files you want apache to look for when a directory is loaded (if it doesn't find any of these files, it displays folder contents). Mine looks like:

                  DirectoryIndex index.php index.html default.html

  • Restart your Apache Server for the changes to take effect: Start > All Programs > Apache HTTP Server 4.2.4 > Control Apache Server > Restart
  1. Configuration on IIS Web Server
  • Copy some .dll files from your PHP directory to your systems directory (usually C:\Winnt\System32). You need php5ts.dll for every case. You will also probably need to copy the file corresponding to your Web server module - C:\PHP\Sapi\php5isapi.dll. It's possible you will also need others from the dlls subfolder - but start with the two mentioned above and add more if you need them.
  • Copy either php.ini-dist or php.ini-recommended (preferably the latter) to your Windows directory (C:\Winnt or C:\Winnt40), and rename it php.ini. Open this file in a text editor (for example, Notepad). Edit this file to get configuration directives; We highly recommend new users set error reporting to E_ALL on their development machines at this point. For now, the most important thing is the doc_root directive under the Paths and Directories section.make sure this matches your IIS Inetpub folder (or wherever you plan to serve out of).
  • Stop and restart the WWW service. Go to theStart menu -> Settings -> Control Panel -> Services. Scroll down the list to IIS Admin Service. Select it and click Stop. After it stops, select World Wide Web Publishing Service and click Start. Stopping and restarting the service from within Internet Service Manager will not suffice. Since this is Windows, you may also wish to reboot.
  1. Now you have configured the PHP with the web server. In this step you have to just testing PHP is working properly. For that if you have installed apache web server then; In your "htdocs" directory (somewhere in Program Files/ apache foundation…), or if you have installed IIS web server then in your www directory (residing under inetpub directory) , create a file called "info.php". Open it in notepad and add this line of code to it:


Open up Internet Explorer or any other web browser you may have and type in: http://localhost/info.php. If your browser takes you to a page that looks like this, then PHP has been installed successfully!



  • Write the install ation steps of PHP. [7 Marks]
  • How will you configure PHP with Apache web server? [2 Marks]
  • How will you configure PHP with IIS web Server? [2 Marks]
  • What are the instalation steps of PHP over Linux OS? [7 Marks]


  1. S
  2. Posted by Email
  3. Posted by Email
  4. Posted by Email
  5. Posted by Email
  6. Posted by Email
  7. Posted by Email
  8. Posted by Email
  9. Posted by Email
  10. Posted by Email
  11. Posted by Email
  12. Posted by Email
  13. Posted by Email
  14. Posted by Email

Leave a comment