"PHP-CLI vs PHP-CGI
Most Linux distributions include both versions of PHP when
installed, especially if you are using a modern distribution such
as CentOS or Mandriva. When writing AGI scripts with PHP, it is
imperative that you use PHP-CLI, and not PHP-CGI.
"Why is this so important? The main issue is that PHP-CLI and
PHP-CGI handle their STDIN (standard input) slightly differently,
which makes the reading of channel variables via PHP-CGI slightly
more problematic.
"The php.ini configuration file
The PHP interpreter includes a configuration file that defines a
set of defaults for the interpreter. For your scripts to work in an
efficient manner, the following must be set—either via the
php.ini file, or by your PHP script: