PHP

 
 
PHP (= Hypertext Preprocessor) is an HTML-embedded server-side scripting language.

PHP is distributed at no charge for commercial or non-commercial use. For more information read the LICENSE information.

More information about PHP can be found at: http://www.php.net

PHP manuals can be found at:
http://www.php.net/manual/en/
http://devzone.zend.com/manual/

The latest PHP version can be downloaded from: http://www.php.net/downloads.php







Installing PHP4 on Apache 2



Information
none

Operating system used
Windows XP Home Edition Version 5.1 SP 2

Software prerequisites
Apache 2

Procedure
  1. Download and unzip php-4.3.7-Win32.zip:
    e.g.: C:\Tools\php-4.3.7-Win32

  2. Apache only needs a few files from the downloaded zip file. Create a directory e.g.: C:\Tools\php which will contain the files we will need.

  3. Copy the following PHP files to the following directories:

    FilesCopy toRemark
    <unzip_dir>\php.exe <php>\php.exe  
    <unzip_dir>\php4ts.dll <php>\php4ts.dll  
    <unzip_dir>\php.ini-dist C:\WINDOWS\php.ini Rename filename php.ini-dist into php.ini
    <unzip_dir>\sapi\php4apache2.dll <php>\php4apache2.dll php4apache.dll is required for Apache 1.3.x
    <unzip_dir>\extensions <php>\extensions The extensions directory is copied because in the future i might use some loadable extensions modules. You can skip this step if you are not using any extensions modules, see GD library.

    Note:
    • <unzip_dir> = C:\Tools\php-4.3.7-Win32
    • <php> = C:\Tools\php

  4. Edit file c:\WINDOWS\php.ini.
    Change the following line:

    ;extension_dir = "./"

    to

    extension_dir = "c:/tools/php/extensions"

    Note: The location of the loadable extensions modules is specified because in the future you might use them. You can skip this step if you are not using any of these modules, see GD library.



  5. Configure Apache by editing C:\Tools\Apache Group\Apache2\conf\httpd.conf:

    • In this example PHP will be run as a module in Apache and not as a CGI library. Add the following line after all the LoadModule statements:
      LoadModule php4_module "c:/tools/php/php4apache2.dll"

    • Add index.php in the DirectoryIndex directive:
      DirectoryIndex index.html index.html.var index.shtm index.htm index.php

    • Add the following line after all the AddType statements:
      AddType application/x-httpd-php .php


  6. Restart Apache.

  7. To test the PHP installation, create a file phpinfo.php with the following line:

    <?php phpinfo(); ?>

    Save this file into your Apache htdocs directory and type: http://localhost/phpinfo.php

    You should see something like this:

    PHPinfo