PHP 5.1.6
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, php5apache2.dll
- Built-in support for : SSL(OpenSSL), compression(zlib), MySQL
Setup
- Unpack as C:\www\php-5.1.6-Win32
- Rename directory C:\www\php-5.1.6-Win32 to C:\www\php
- 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/ext/
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]
- Add
C:\www\php to the System PATH
- Set PATH under Start » Settings » Control Panel » System » Advanced » Environment Variables » System variables » Path
[make sure that files php5ts.dll and php5apache2.dll do NOT also reside under your %SYSTEMROOT%\system32 directory, from a previous installation]
PHP Extensions
- Edit %SYSTEMROOT%\php.ini, uncomment the extensions you wish to use under the 'Dynamic Extensions' Section.
- Note that MySQL support is no longer provided by default -- uncomment extension 'php_mysql.dll' for MySQL 4.0 or insert new extension 'php_mysqli.dll' for MySQL 4.1+ support
Configuration for Apache 2.0
- Edit C:\www\Apache2\conf\httpd.conf
- Add
LoadModule php5_module C:/www/php/php5apache2.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