How to Install PHP on Windows (Fast PHP Tutorial Part 2)

Hi dear pupils!

Today we will learn,

  1. How to Install PHP on Windows
  2. How to Install PHP on Linux
  3. How to Install Apache on Windows to support PHP
  4. How to run PHP with IIS

lets begin with How to Install PHP On Windows

Well, first of all visit PHP Official Website and download Windows Binary Installation files. There are different versions of PHP the latest version is PHP 5.2.0 at the time of writing this article.

One more thing, you will see two kinds of Windows Binary files .zip and .exe I am going to follow .zip file installation as .exe will not install PHP as Apache module on Windows. So if you are going to follow this tutorial then download .zip file.

Now create a directory for your PHP installation typically on “C:\PHP”, and create a temporary directory, may be “C:\PHP\temp” to unzip the files. As we don’t need all the files included in the .zip archive for PHP installation so first we are going to unzip the files in the temporary directory that we just created and then we will copy only those files to main “C:\PHP” directory which are needed for PHP installation.

Now unzip the downloaded file to the temporary directory “C:\PHP\temp” and copy the following files to main PHP directory “C:\PHP”

  • php.exe
  • php5ts.dll
  • php5apache.dll
  • php5apache2.dll

the file names will differ according to the version of PHP you downloaded. Remember we need php5apcahe.dll if you want to run PHP with Apache 1.3 version and php5apache2.dll for Apache 2.x version so you can skip one of them. You can find these files in the temporary directory (where you unzipped the zip archive) under ’sapi’ folder.
Also if you want to use the different PHP extensions then copy files in extensions folder from temporary directory to main PHP directory though make sure your PHP is working fine before messing up with extensions’ installation.

Also MySQL is already enabled by now and you don’t need to do anything extra to enable it with PHP.

Now copy the php.ini-dist file to your Windows installation folder typically C:\WINDOWS and rename it to php.ini (remove -dist from the name)

Congratulations! you are done with the PHP installation on Windows :)

However, let me tell you some additional information about configuring PHP to fit to your needs and requirements.

PHP Configuration:

If you want to use posted variables with their direct names e.g $var1, $name etc then you need to switch on the Global Variables in the php.ini file that we just moved to Windows installation folder. Open the php.ini file with notepad and search for this line

register_globals = Off

change Off to On and you are done.

Remember if you will not turn it on then you would have to access your posted variables with the REQUEST GLOBAL ARRAY reference i.e $_REQUEST[’var1′] etc


If you want to send emails from your local PC using your ISP then you need to set up your SMTP server in the php.ini file , search for this code
[mail function]

;for win32 only

SMTP = localhost

;for wind32 only


and change it accordingly to your SMTP server settings e.g

[mail function]

;for win32 only


;for wind32 only


If you are terribly confused with this SMTP thing then don’t worry, You are a NEWBIE ! so just forget about it and once we are handling Mail in PHP then you will understand the need and use of SMTP server etc


  1. Articles Repository » Blog Archive » Run 2 Versions of PHP concurrently on Windows said,

    December 27, 2006 at 4:04 pm

    […] Note: Changes to PHP configurations files will be needed. There are generic tips here. More specific settings will be posted in this section shortly. […]

  2. Articles Repository » Blog Archive » PHP Ini Tweaks said,

    December 27, 2006 at 10:39 pm

    […] Mail settings have already been covered in this article. However, if you want to have multiple instances of PHP or just make the installation cleaner, then lets assume you have extracted the PHP files into X:/Program Files/Apache Group/php/php-5.2.0-Win32 and X:/Program Files/Apache Group/php/php-6.0.0-Win32. […]

  3. Articles Repository » Blog Archive » PHP programming basics said,

    January 9, 2007 at 4:54 pm

    […] How to install PHP on windows How to install PHP on Linux How to install Apache on Windows PHP, MySQL, Apache installers […]

  4. David Bradley said,

    January 18, 2007 at 10:33 pm

    Will installing PHP on Windows allow me to test standalone PHP pages for a website without uploading them to the site?

  5. haroon.ahmad said,

    January 19, 2007 at 10:42 am

    when you install php on windows you in fact create a php environment for you. you can even set your application on your pc and get a static ip for it and publish it from your own pc you dont need hosting packages… you can use localhost/phppagesfolder/script.php links in your browse to pick the pages from your web directory that you set up for php pages.

  6. Articles Repository » Blog Archive » Loops in PHP said,

    January 20, 2007 at 11:52 pm

    […] FAST PHP Tutorial (Part 1) How to Install PHP on Windows (Fast PHP Tutorial Part 2) How To Install PHP On LinuxHow To Install Apache on WindowsEasy Installers to Install PHP, MySQL, Apache on Windows in PHPDecision Making using IF-ELSE in phpDecision Making using PHP Switch Statement […]

  7. Articles Repository » Blog Archive » Detailed Guide On Arrays In PHP said,

    February 1, 2007 at 10:11 am

    […] FAST PHP Tutorial (Part 1) How to Install PHP on Windows (Fast PHP Tutorial Part 2) How To Install PHP On Linux How To Install Apache on Windows Easy Installers to Install PHP, MySQL, Apache on Windows PHP Programming Basics Operators in PHP Decision Making using IF-ELSE in php Decision Making using PHP Switch Statement Loops In PHP […]

Post a Comment

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word