build-website-header
spacer-image
 

Installing Wordpress On Windows (2000 and XP) -Part 2 Installing PHP

The next step is to install PHP. I used version 4.4 as I already had the download on my machine from an install last year.

Here is the link to the download page. I would suggest you use the 4.6 version  (march 2007).

You may find that there is a windows installer and a zip package.

 You should get them both as the installer package doesn't contain all of the files you may need.

I prefer to use the installer as the setup is easier and I'm not worried about security as its on a local network anyway. If you don't get an installer (there isn't one with the 4.6) then you need to extract them using winzip which puts them in the required folders under a directory called php-4.4.6-win32.

php folder structure

Just rename it to php4.

For php4 you will need to copy all of the files from the sapi and dls folders to the php4 folder.

Now you need to edit the httpd.conf file. You may need to modify the directories like C:\php to reflect your configuration and Note that the configuration file httpd.conf uses forward slashes!!

You will normally find the http.conf file in program files\apache group\apache2\ ,but it depends on how you did the install.

Blue highlight are for a php4 configuration which is what I did

You should add the following lines to your Apache httpd.conf file:

Example 2-3. PHP as an Apache 1.3.x module

This assumes PHP is installed to c:\php. Adjust the path if this is
not the case.

For PHP 4:
# Add to the end of the LoadModule section
LoadModule php4_module "c:/php/php4apache.dll"


For PHP 5:
# Add to the end of the LoadModule section
LoadModule php5_module "c:/php/php5apache.dll"


For both:

AddType application/x-httpd-php .php


# For syntax highlighted .phps files, also add
AddType application/x-httpd-php-source .phps

In  addition:


Addtype application/x-httpd-php .php

Tells apache to treat files with a .php extension as scripts. If you want apache to process normal .htm or .html files as scripts (often done as some don't like using the .php extension) the add them as well like this.


Addtype application/x-httpd-php .php .htm .html

Next locate the directoryIndex line which should read like this

DirectoryIndex index.html index.htm.var

change it to this

DirectoryIndex index.html index.htm.var index.htm index.php

This tells apache what file to serve if the visitor only types the directory path e.g.

If you type www.build-your-website.co.uk and not www.build-your-website.co.uk/index.htm then Apache will server either:-index.html, index.htm.var, index.htm or index.php depending on which one it finds in the directory.

If more than one is present then the order they appear in the DirectoryIndex statement is the order of preference.

PHP.INI Configuration File

php.ini  is the main configuration file for php. Locate the php.ini-recommended. This doesn't need editing yet but you need to rename it to php.ini and place it in the windows search path. This is either c:\windows or c:\winnt depending on whether you are using XP or windows 2000.

Note: I prefer to make a copy rather than renaming it just in case I need to go back to the original. To do that just open it with Notepade and use save as to save it as php.ini. (again beware that it is php.ini.txt)

You should also locate the php4ts.dll or php5ts.dll (depending on the php version) and copy it to the c:\winnt\system or c:\windows\system directory.

Testing The Install

To test you need to place a php file on the web server and access it. The standard test is to use a phpinfo.php file which will display the server setup details.

This is a simple file with single entry. Here it is:

<?phpinfo()?>

Just open notepad type in the above and save as phpinfo.php. Make sure that you don't save it as phpinfo.php.txt. This is a common mistake as Windows XP turns off file extensions by default.

So enable them by opening a folder go to Tools>folder options and click the view tab an untick the hide extensions for known file types box.

Place the phpinfo.php in the htdocs folder and open a web browser and type

http://localhost/phpinfo.php

You should see something like this :

test php install

 

 

Now its time to Install MYSQL


 

 

spacer2-image