Server Application Programming Interface - SAPI helps interacting between the outside world and the PHP/Zend engine. PHP comes with muliple SAPI modules for using it in command line, with web servers or even embedding it in other applications.
Using PHP in command line interface.
PHP includes an interactive debugger called phpdbg
implemented as a SAPI module.