note 23900 added to install.commandline

From: Date: Wed, 31 Jul 2002 09:49:41 +0000
Subject: note 23900 added to install.commandline
Groups: php.notes 
Request: Send a blank email to php-notes+get-34042@lists.php.net to get a copy of this message
Using a php4 cgi script with a non-Apache server (boa,thttpd,etc) leads to unexpected results: #!/usr/local/bin/php <?php SOMETHING ?> will work just fine from the command line but not when called from the web server. The problem is that php4 expects to be called by an "Action" directive of the server... unfortunately boa (and many others) does not support the action directive and calls the script directly. HOW TO SOLVE: (works only with linux AFAIK) you must compile your kernel with support for binfmt_misc then register php as a binary handler for php scripts echo ":PHP:E::php::/usr/local/bin/php:" > /proc/sys/fs/binfmt_misc/register and remove the #!/usr/local/bin/php line in your script NOTE: for recent 2.4.x kernels you must mount binfmt_misc mount -t binfmt_misc none /proc/sys/fs/binfmt_misc -- http://www.php.net/manual/en/install.commandline.php http://master.php.net/manage/user-notes.php?action=edit+23900 http://master.php.net/manage/user-notes.php?action=delete+23900 http://master.php.net/manage/user-notes.php?action=reject+23900

« previous php.notes (#34042) next »