How to force php files to use CLI

To force php files to use CLI (on the assumption your default php version uses suPHP) create an .htaccess file in your public_html directory, with the following:

<FilesMatch “\.php$”>
AddHandler application/x-httpd-php .php

As of version 4.3.0, PHP supports a new SAPI type (Server Application Programming Interface) named CLI which means Command Line Interface. As the name implies, this SAPI type main focus is on developing shell (or desktop as well) applications with PHP. There are quite a few differences between the CLI SAPI and other SAPIs which are explained in this chapter. It’s worth mentioning that CLI and CGI are different SAPI’s although they do share many of the same behaviors.

The list of command line options provided by the PHP binary can be queried anytime by running PHP with the -h switch


Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.