Приглашаем посетить
Чулков (chulkov.lit-info.ru)

Installation Decisions

Table of Contents
Previous Next

Installation Decisions

There are various methods to install PHP on either UNIX-like or Windows operating systems: Install Wizards, RPMs, and ports are available for most platforms, which makes source code compilation an option. Here we'll give you an overview of the pros and cons, and detailed instructions for the more common options. But first let's see some high level decisions that need to be made before we install PHP.

Which Operating System?

The decision of which operating system you have to use is usually pre-determined. If, however, you need to decide on an operating system, and just want whatever is best for PHP, you're probably better off with a UNIX-like OS. While the core of PHP itself runs flawlessly under Windows, some of the more esoteric and interesting third party software packages are unavailable for Windows, or can only be safely run via CGI (Common Gateway Interface) rather than as a module.

Installation may be slightly harder under UNIX-like OSs, but the feature set and reliability will usually be worth it for most users. There will be more about CGI versus module installation in the next section, but for now, be aware that the only critical differences occue under extremely heavy loads. So unless your site is getting or truly expecting millions of hits a day, your OS decision should be based on factors other than PHP, which will happily work just fine with almost any OS you choose.

Module or CGI?

Next, you need to decide whether to install PHP as a module or as a CGI. As a module, PHP becomes a part of the web server. When the web server is started, PHP is always there with the web server, ready and waiting. When run as a CGI, PHP is run as a separate program every time a request for a web page is made. That is, a user asks for a URL, the web server runs PHP to get the content, and then PHP quits.

As you can imagine, running as a module is usually far more efficient than running as a CGI, since the PHP program doesn't need to start and quit for every request. Also, tighter integration between web server and modules allow features that are not possible when running PHP as a CGI. However, there are some specific cases where running as a CGI provides flexibility that is not available as a module. Specifically, PHP running as a CGI can be configured to run as a different user with more (or less) privileges than PHP running as a module of the web server.

Note that running PHP as a module does not stop you from having it available as a CGI, which is also useful for non-web activities such as scheduled events. For example, you may use PHP as a module on your web site, while using the CGI as a standalone interpreter to do routine maintenance of database tables or schedule e-mails.

In some cases, the decision is taken out of your hands, since PHP cannot run as a module for every web server. PHP can run as a CGI on every web server that supports CGI (virtually all web servers support CGI). Only the following web servers also support running PHP as a module.

Module Support for UNIX-Based Web Servers

  • Apache

  • thttpd

  • fhttpd

  • Zeus

  • Roxen

  • Pi3Web

Module Support for Windows-Based Web Servers

  • Microsoft IIS 4.0, 5.0*

  • AOLServer

  • WebSphere

  • Netscape web server

  • iPlanet (A Sun and NetScape joint venture)

  • Any ISAPI compliant server

At the time of writing, the ISAPI compliant version of PHP was still in the beta testing phase and should not be used in production-quality web sites. It is recommended that the standalone CGI-PHP interpreter be used for PHP work. Actually, the core of PHP is quite stable under ISAPI. However, the third party software packages, and the PHP interfaces to them are not all thread-safe. You may be able to use PHP as a module under Windows with ISAPI, but you'll need to thoroughly test the third party DLL extensions under heavy loads to be sure the third party software is thread-safe.

Don't let the beta status of ISAPI support necessarily stop you from installing PHP as a CGI on a Windows platform. Unless your Windows web server is having extremely heavy traffic, the PHP CGI installation will work just fine. Only under very heavy traffic does the module have a definite advantage over CGI. The other CGI versus module issues are minor and have simple workarounds. Also, installing PHP as a CGI on Windows-based development machines, while using PHP as a module on a UNIX- based web server, is extremely viable for most cases.

Which Web Server?

Your final major choice is the web server to go with PHP. This also may be pre-ordained by external factors such as management, or what is already available and in use. If not, Apache is probably the best bet for most users. It's on a par or superior to the other choices. From a technical standpoint, it runs well under both Windows and UNIX-like operating systems, and the freely available help resources are far more numerous than with the other options.

You need to make these high level decisions, which affect how you should install PHP, before you embark on the installation process. Under Windows, you are either stuck with CGI or you need to test heavily. Under UNIX-like systems, it's better to install PHP as a module.


Table of Contents
Previous Next