1. Apache: go to http://httpd.apache.org. for windows, the link for the Win32 Binary (MSI Installer) to download the installer file.
2. PHP: www.php.net. Extract the files from the .zip file into the directory where you want PHP to be installed, such as c:\php.
3. configure apache for php.
Configuring Apache on Windows
You must edit an Apache configuration file, called httpd.conf, before PHP can run properly. To configure Apache for PHP, follow these steps:
Open httpd.conf for editing.
To open the file, choose StartðProgramsðApache HTTPD ServerðConfigure Apache ServerðEdit Configuration.
If Edit Configuration isn't on your Start menu, find the httpd.conf file on your hard drive, usually in the directory where Apache is installed, in a conf subdirectory (for example, c:\program files\Apache group\Apache\conf). Open this file in a text editor, such as Notepad or WordPad.
Activate the PHP module.
Look for the module statement section in the file and locate the following line:
#LoadModule php6_module "c:/php/php6apache2.dll"
Remove the # from the beginning of the line to activate the module. If you're installing PHP 5, you need the following line:
LoadModule php5_module "c:/php/php5apache2.dll"
LoadModule php5_module "c:/php/php5apache2_2.dll"
If you're using Apache 1.3, rather than Apache 2, the module name is php6apache.dll or php5apache.dll.
Tell Apache which files are PHP programs.
Look for a section describing AddType. This section might contain one or more AddType lines for other software. The AddType line for PHP is
AddType application/x-httpd-php .php
Look for this line. If you find it with a pound sign at the beginning of the line, remove the pound sign. If you don't find the line, add it to the list of AddType statements. You can specify any extension or series of extensions.
This line tells Apache that files with the .php extension are files of the type application/x-httpd-php. Apache then knows to send files with .php extensions to the PHP module.
where you put the files.
DocumentRoot "C:/mysites"
#DocumentRoot "C:/Apache2.2/htdocs"
Start Apache (if it isn't running) or restart Apache (if it is running).
You can start it as a service in Windows NT/2000/XP/Vista by choosing StartðProgramsðApache HTTPD ServerðControl Apache Server and then selecting Start or Restart. You can start it in Windows 98/Me by choosing StartðProgramsðApache Web ServerðManagement.
Sometimes restarting Apache isn't sufficient; you must stop it first and then start it. In addition, your computer is undoubtedly set up so that Apache will start whenever the computer starts. Therefore, you can shut down and then start your computer to restart Apache.
4. configure php
Open the php.ini file for editing.
Change the settings you want to change.
Steps 3, 4, and 5 mention some specific settings that you should always change if you're using the specified environment.
Only if you're using PHP 5 or earlier, turn off magic quotes.
Look for the following line:
magic_quotes-gpc On
Change On to Off.
Only if you're using PHP 5 or 6 on Windows, activate mysqli or mysql support.
See instructions in the section "Activating MySQL Support on Windows," later in this chapter.
Only if you're using PHP on Windows with the IIS Web server, turn off force redirect.
Find this line:
;cgi.force_redirect = 1
You need to remove the semicolon so that the setting is active, and also change the 1 to 0. After the changes, the line looks as follows:
cgi.force_redirect = 0
Only if you're using PHP 5 or later, set your local time zone.
Find the line:
;date.timezone =
Remove the semicolon from the beginning of the line. Add the code for your local time zone after the equal sign. For instance, the line might be
date.timezone = America/Los_Angeles
You can find a list of time zone codes at www.php.net/manual/en/timezones.php.
Save the php.ini file.
Restart your Web server so that the new settings go into effect.
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment