Traditionally, PHP is used in web environments to produce HTML markup that the user views in a web browser. The interaction between PHP and the web server (Apache, AOLserver, Microsoft IIS, or whatever) happens through a layer called SAPI (short for web Server API). A separate build of PHP is required to interface with each type of web server through SAPI.
In this chapter, you explore the CLI (short for Command Line Interface) server API, which makes PHP a traditional scripting language. This chapter demonstrates using CLI for writing command-line tools as well as a stand-alone server application.
Figure 16.1 shows what parts of PHP are present when it is built for different SAPI implementations.
Figure 16.1. Parts of PHP present when built for different SAPI implementations.