articles

PHP Installation on Windows

Anonymous User9375 31-Aug-2011

Installing PHP on Windows 7 is quite simple. Before installing PHP into your computer you need to have web server running in your computer. Here I preferred to use ‘Apache’ web server for this demonstration.  Click here to download Apache web server.

 Though I am on a 64 bit Windows 7 operating system, I downloaded Thread safe php-5.3.8-Win32-VC9-x86.zip file (A Thread Safe version should be used if you install PHP as an Apache module whereas Non Thread Safe version should be used if you install PHP as a CGI binary). This article will describe you, how to install PHP files in your computer.

Step 1:  First Create a directory where you want to install PHP file. Here I preferred to use C drive to install PHP files. Now create a folder with name php in c drive and extract downloaded php zip file into this folder.

Step 2: Now open c:\php folder, you will see php.ini-recommended file, copy this file and paste in same directory with name php.ini. If php.ini-recommended file is not found (In the case of higher version) then you will see two file with name php.ini-development and php.ini-production, copy php.ini-development and paste in same directory with new name php.ini.

Let’s have some snapshot of PHP file.

PHP Installation on Windows

Now extract PHP zip file into creating directory path ‘c: \php’

PHP Installation on Windows

Before proceeding next step of PHP installation let’s we have some snapshot for installing ‘Apache’ web server. You can see here, how to install Apache web server in windows 7 operating system.

Step 3:Configure Apache Web Server 2.2 for PHP installation

Now configure Apache web server for PHP installation. Though you have been able to put PHP on your computer, it's still not "installed" in the true sense of the word. We have to configure Apache web server to communicate with PHP. This is done by editing the Apache configuration file which is ‘httpd.conf’.

Step 3(a):

PHP Installation on Windows

The ‘httpd.conf’ file will be appear as

PHP Installation on Windows

Step 3(b):: Now locate the ‘LoadModule’ in file ‘httpd.conf’ and write the following line of code  

LoadModule  php5_module “C:/php/php5apache2_2.dll”

Note: You can use ‘ctrl+F’ for search in ‘httpd.conf’ file.

PHP Installation on Windows

Step 3(c):: Locate AddType in file ‘httpd.conf’ and write the following code of line.

AddType  application/x-httpd-php 

PHP Installation on Windows

Note: Here you can specify other php file extension such as php3, .php4 etc..

 Step 3(d): Move to the end of httpd.conf file and add the below line of code

PHPIniDir  “c:/php”

PHP Installation on Windows

Note: PHPIniDir  “C:/php” tells the Apache web server the location of the PHP configuration file - php.ini.

When we have installed Apache web server, there is ‘htdocs’ directory available where you can put your php file. When you load http://localhost, Apache checks the htdocs folder – displays "It works” message, if php installation successfully completed. File that's displayed first time you test Apache installation is actually the index.html

PHP Installation on Windows
Here I am creating a directory with name MySiteFile, and put all php file into this directory.

PHP Installation on Windows

PHP Installation on Windows

Now we have to test whether PHP was properly installed or not on Windows 7. So start Apache Server and type http://localhost:85/ (85 is a port no) in web address of browser. If PHP installed successfully then it show ‘It Works!’ (By default message) and if not then display an error message.

PHP Installation on Windows

If you type http://localhost:85/MysiteFile then your php file will be displayed.

PHP Installation on Windows



Updated 07-Sep-2019
I am a content writter !

Leave Comment

Comments

Liked By