want to join us? register, it's easy | help

FAST PHP Tutorials

How to Install PHP on Windows

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

Setting Up SMTP SERVER:

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

sendmail_from= me@localhost.com

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

[mail function]

;for win32 only

SMTP = mail.yourisp.com

;for wind32 only

sendmail_from= you@somemailservice.com

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