Installing and configuring PHP
Steps 1 and 2 - Download and Install the latest version.
Step 1 - Download the Latest stable version.
Go to http://www.php.net/downloads.php and download the latest stable release. I mentioned before that I had installed php 4.3.3 RC1 - However , version 4.3.4 is now available from php.net as the latest release. I have not tested this version yet but will update this tutorial to reflect any changes once finished. This tutorial concentrates on version 4.3.3.
Click on 'php 4.3.3 zip package' which takes you to a download mirror site in which to download the file named 'php-4.3.3-win32.zip' , save it to your hard drive in a suitable temporary location. (In case of re-installs being necessary I have a permanent location called 'Master Programs' where I download to and extract from there)
Step 2 - Install PHP
Following on from our previous related tutorial on Apache, extract all files and sub-folders to 'C:\Apache2\php' - if you extract elsewhere, please remember to substitute this file path in any future references.
Copy php.ini-dist file to C:\windows (or c:\%system%) and rename the newly copied file to php.ini.
Steps 3 & 4 - Configure PHP for Apache2 & vice-versa
Step 3 - Configure PHP for Apache2
Edit php.ini in notepad and scroll down to the 'Paths and Directories' section.
· Replace 'doc_root='
with 'doc_root= "c:\apache2\apache2\htdocs' --------> Change file path accordingly if needed to whatever your Apache Servers document_root is. (In httpd.conf)
· Replace 'extension_dir='
with 'extension_dir="c:\apache2\php' ---------> Change if needed to where you extracted the php files to earlier.
Save and Close php.ini.
· Copy 'php4apache2.dll' (or php4apache.dll if using version 1.x.x) from the 'c:\apache2\php\sapi' folder to 'c:\apache2\php' making sure that 'php4ts.dll' is there also.
· Copy ALL dll files from 'c:\apache2\php\dlls' folder to 'c:\windows\system32' folder.
If any dlls already exist in system32 folder , DO NOT* overwrite them unless php does not work after following the 'Step 5 -Testing Your Installation' section.
* - dlls are funny creatures, shared files being used by many programs, in my case I did overwrite all dlls that were in the system32 folder and have suffered no side effects as a result. I do not however want to be held accountable should you have a program that requires an older version of a dll that this installation might otherwise overwrite.
Step 4 - Configure Apache2 for PHP
Revisiting our earlier Apache 2 tutorial I said:-
Locate and edit 'httpd.conf' file (should be in 'C:\Apache2\Apache2\conf\httpd.conf')
--------------
In Section 1 : Global Environment.
ServerRoot should say : ServerRoot "C:/Apache2/Apache2"
Locate '#ExtendedStatus On' and just below it add :-
AddHandler server-parsed .shtml
#LoadModule php4_module "c:/apache2/php/php4apache2.dll"
#AddType application/x-httpd-php .php
The last 2 lines above are commented out to avoid errors, they will be un-commented when php4 is installed,but we put them here now to save time later.
So now we want to un-comment out those lines so they read like this :-
LoadModule php4_module "c:/apache2/php/php4apache2.dll"
AddType application/x-httpd-php .php
The rest of 'httpd.conf' should be ok if the earlier tut was followed, so Save and Close this file then 'Stop and Start' the Apache Server service. (A soft start called a 're-start' differs slightly in operation from Stop/Start in regards to the Apache Server and I have had problems with it in the past so don't recommend it until all bugs are squashed!)
Ok, so lets get testing!
Step 5 - Testing your Installation.
Open Notepad (or whatever) and paste the following code into it:-
and save the file as phpinfo.php Open your browser and go to 'http:\\localhost\phpinfo.php' With a bit of luck you should have a screen full of Server related information and variables. If not, something has gone wrong with the installation somewhere and a careful check of the steps is required - or ask in our forums for advice, it is usually a simple config error or path related problem and nothing serious. Thanks for listening, the next phase in this series of Articles is to install and configure mySQL for use with Apache2 and PHP 4.3.3. After that is the installation tutorial for a forums board not unlike the one on this site. Both of these will be finished and posted soon.
Labels: Website Design
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home