PHP 4.4.4
Building a Web Server, for Windows
Requirements
Download
Our Configuration
- %SYSTEMROOT% : Win2000 -> C:\WINNT, WinXP -> C:\Windows
- Install to : C:\www\php
- Apache path : C:\www\Apache2
- Server webroot : C:\www\webroot
- PHP run-type : Apache 2.0 dynamically loaded SAPI module, php4apache2.dll
- Built-in support for : SSL(OpenSSL), compression(zlib), MySQL
Setup
- Unpack as C:\www\php-4.4.4-Win32
- Rename directory C:\www\php-4.4.4-Win32 to C:\www\php
- Copy file php4apache2.dll from C:\www\php\sapi to C:\www\php
- [php4apache2.dll has to reside under the same directory as php4ts.dll]
- Copy file php.ini-recommended from C:\www\php to your %SYSTEMROOT% directory
- Rename file %SYSTEMROOT%\php.ini-recommended to php.ini
- Edit %SYSTEMROOT%\php.ini
doc_root = C:/www/webroot/
- [the directory your web server will be serving content from]
extension_dir = C:/www/php/extensions/
session.save_path = C:/www/tmp/
- [location where temporary data files should be stored, needed for PHP's session functions]
- [make sure this directory exists - if not, create it]
PHP Extensions
- Edit %SYSTEMROOT%\php.ini, uncomment the extensions you wish to use under the 'Dynamic Extensions' Section.
- Some extensions will require additional dlls to be loaded...
- Method 1: [Recommended]
Add C:\www\php\dlls to the System PATH
- Set PATH under Start » Settings » Control Panel » System » Advanced » Environment Variables » System variables » Path
- Reboot
- Method 2:
Copy individual dlls from C:\www\php\dlls to %SYSTEMROOT%\system32
- If using PHP extension
php_mcrypt, download libmcrypt.dll
- Place libmcrypt.dll under directory C:\www\php\dlls if Method 1 was used, otherwise follow Method 2
Configuration for Apache 2.0
- Edit C:\www\Apache2\conf\httpd.conf
- Add
LoadModule php4_module C:/www/php/php4apache2.dll to the bottom of the LoadModule list
- [note the unix forward style slashes (/), instead of windows style back slashes (\)]
- Edit
DirectoryIndex index.html index.html.var index.php
- [adds index.php to the end of the DirectoryIndex field]
- Insert lines...
AddType application/x-httpd-php .php [maps file extension .php to PHP]
AddType application/x-httpd-php-source .phps [activates PHP syntax coloring]
Configuration for zlib
Modifications need to be made to php.ini to switch on zlib compression detection and encoding.
- Edit %SYSTEMROOT%\php.ini
- Method 1: [Recommended]
Leave the compression to Apache's mod_deflate (which can work around browsers that do not conform to the standards and deal with proxies)...
output_buffering = On
output_handler =
zlib.output_compression = Off
- Method 2:
Redirect all output to the ob_gzhandler compression function...
output_buffering = On
output_handler = ob_gzhandler
zlib.output_compression = Off
- Method 3:
Transparent output compression using the zlib library...
output_buffering = Off
output_handler =
zlib.output_compression = On
Testing
- Create phpinfo.php, containing the following code, and place under Apache's webroot directory...
<?php phpinfo(); ?>
- Access URL http://localhost/phpinfo.php