Installing PHP4 on Apache 2
Information
none
Operating system used
Windows XP Home Edition Version 5.1 SP 2
Software prerequisites
Apache 2
Procedure
- Download and unzip php-4.3.7-Win32.zip:
e.g.: C:\Tools\php-4.3.7-Win32
- 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.
- Copy the following PHP files to the following directories:
<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
- 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.
- 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
- Restart Apache.
- 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:
|