note 23900 deleted from install.unix.commandline by bjori
| From: | bjori@php.net | Date: | Wed, 22 Mar 2006 20:09:59 +0000 |
| Subject: | note 23900 deleted from install.unix.commandline by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-106331@lists.php.net to get a copy of this message | ||
Note Submitter: nordkynNOSPAMPLZ at tin dot it
----
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