Appendix C. Installing PHP 5 Alongside PHP 4

A major difficulty in migrating from PHP 4 to PHP 5 is testing code under PHP 5 without giving up PHP 4. You cannot install both Apache modules on the same web server, but it’s possible to install one as a CGI. This allows you to experiment with PHP 5 and debug your applications without giving up PHP 4 in the process.

The CGI version of PHP is less efficient than the module version and has a few limitations, such as the inability to hook into Apache’s HTTP Basic Authentication mechanism. Nevertheless, this is a good way to start out using PHP 5. When you’re just testing scripts, performance is less of a problem. When most of your code is PHP 5-ready, you can then install the module version of PHP 5 for final testing and benchmarking and run PHP 4 as a CGI.

This appendix is more technical than other parts of the book. It assumes you’re comfortable installing PHP from source code and have root access on your machine. It also assumes you’re using PHP with the Apache web server. If you’re running a different server, you must translate these instructions accordingly.

General PHP 5 Configuration

Since you’re already using PHP, this section does not repeat the full set of PHP installation and configuration instructions. If you get stuck, information for many web servers and operating systems is available at

Instead of detailed instructions, this section provides a brief recap of the install process and a list of ...

Get Upgrading to PHP 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.