I have been unable to get the PHP binary to work as a CGI under apache. Running the script on the command-line works just fine and seems to output all the correct information, however when the script is accessed under apache, a 500 error is returned, and the logfiles show "Premature end of script headers." mod_php, however, works just fine.
To use the PHP binary, you need to add this to your httpd.conf file: Action php-handler /cgi-bin/php AddHandler php-handler .php4 .php3 .phtml .php ...and copy the php binary from /usr/bin to /var/www/cgi-bin (where we don't put it by default because it might cause problems on "Everything" installs).