Windows Installation


The instructions in this section take you through installing PHP into an Apache web server on a Windows system.

Installing Apache

If you already have an Apache web server installed on your system, you can skip this section.

Download the latest version of Apache from httpd.apache.org. The file to get is the MSI Installer package, named apache_2.0.52-win32-x86-no_ssl.msi for the current Apache 2.0.52 release. Save this file to your desktop and double-click to begin the installation process.

The installation process is done through a wizard and is mostly self-explanatory. You must accept the license terms to continue with the installation, after which you are shown some release notes. Click Next after you have read these, and you are asked to enter your server information.

Enter your server's domain name and hostname and your email address. If you are installing on a personal workstation, you should use localhost and localdomain for your server information. You should leave the recommended option to install Apache on port 80 selected.

When asked to choose a setup type, you should select the typical setup. Then you are given the opportunity to select the destination folder for the Apache files. By default, this is C:\Program Files\Apache Group. Finally, Apache is ready to install, and clicking the Install button causes your system to start copying and setting up files on your system.

When the installation is complete, the Apache server and monitor program start up, and you see a new icon in your system tray. You can double-click this icon to bring up the Apache Service Monitor, which you can use to start and stop the web server process. A green light indicates a running server.

Installing PHP

You can download the latest version of PHP from the Windows Binaries section of www.php.net/downloads.php. You should choose the zip file rather than the installer package; it is named php-5.0.3-Win32.zip for the latest version of PHP, which is 5.0.3 at this writing. If a later version is available, be sure to substitute the appropriate version number wherever it appears in a filename.

You need to save the zip file to your desktop and double-click it to extract it to C:\php. You can choose another location, as long as you also change the other instructions in this section to reflect it.

Next, you need to add the PHP module to Apache. Using the file explorer, you need to open the Apache configuration directory (if you used the default location, it should be C:\Program Files\Apache Group\Apache2\conf) and edit httpd.conf. Then you need to add the following lines to the end of the file:

 LoadModule php5_module c:/php/php5apache2.dll AddType application/x-httpd-php .php 

When you next restart your web server from the Apache monitor, the PHP extension will be loaded. To test PHP, you can create in the htdocs folder under your Apache installation location a simple script that looks like this:

 <?php phpinfo(); ?> 

In your web browser, if you visit http://localhost/index.php, you should see a page that gives lots of information on the PHP configuration.



    Sams Teach Yourself PHP in 10 Minutes
    Sams Teach Yourself PHP in 10 Minutes
    ISBN: 0672327627
    EAN: 2147483647
    Year: 2005
    Pages: 151
    Authors: Chris Newman

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net