Team LiB
Previous Section Next Section


Installing PHP 5 itself is covered in depth in Appendix A, "Installing PHP5 and MySQL." This certainly includes upgrading PHP. The old version must be removed, and the new version gets installed. However, there is a good chance that you can preserve most of your configuration files, both for your Web server and PHP itself.

Let's start with the Web server configuration. Changes depend on whether you installed PHP as a module or as a CGI program. For modules, the most important change is that the module name has changed between PHP 4 and PHP 5. Windows users especially have to consider this. With PHP 4, their Apache httpd.conf contains the following line:

LoadModule php4_module /path/to/php4apache.dll

In PHP 5, both the module's tag name and filename have changed and carry the number 5:

LoadModule php5_module /path/to/php5apache.dll

This change obviously irritated so many users that the bug report page now carries a warning not to report this (bogus) bug (see Figure C.1).

Figure C.1. Reporting a bugbut not specified module not found.

Also note that in the Windows version, the location of the ISAPI DLL has changed. In PHP 4, the module resides in a subdirectory called sapi, whereas PHP 5 has the module in the main directory of the PHP installation.

Windows CGI users, on the other hand, were hit by another change that happened during the beta cycle of PHP 5: The file name of the PHP executable changed from php.exe (the name it had since the very first Windows port) to php-cgi.exe. The file php.exe in the PHP 5 ZIP archive is the CLI version. So the configuration has to be updated, either httpd.conf for Apache or the file extensions mapping in Microsoft's IIS.


If you do not want to touch your configuration, it also helps to rename php.exe to php.exe.old and then copy php-cgi.exe to php.exe; then your old configuration is still valid.

The php.ini configuration file can remain unchanged. On the Windows system, however, one change should be noted. In PHP 4 (and in earlier beta versions of PHP 5), the directory that contains the PHP extensions, such as MSSQL support, was named extensions.

The Release Candidates and the final version of PHP 5 have all extension DLLs in the directory ext, bringing the naming convention closer to the PHP CVS naming conventions. Therefore, change this line:

extension_dir = C:\php\extensions

to this one:

extension_dir = C:\php\ext


It is certainly a good idea to analyze the file php.ini-recommended that ships with PHP 5, both for configuration recommendations and for new configuration switches. lists all new directives for php.ini. Probably the most important one is register_long_arrays. If this is switched off, the $HTTP_*_VARS arrays are no longer registered. Because Web hosters are free to switch those (deprecated) arrays off, now is the time to eliminate all occurrences and replace them by the $_* arrays.

    Team LiB
    Previous Section Next Section