All pastes #298441 Raw Edit

Someone

public text v1 · immutable
#298441 ·published 2006-12-31 23:13 UTC
rendered paste body

I realise this is an 'upstream' issue, but it still definately is a valid bug.  The php binary /usr/bin/php should be the 'php-cli' version, NOT the 'generates http headers' version. Specifically, php when run from the command line should NOT generate http headers:

(Debian machine:)
root@fs:/# cat /tmp/test.php
#!/usr/bin/env php
<? echo "Foo\n"; ?>
root@fs:/# /tmp/test.php
Foo
root@fs:/#

Note that for portability, php scripts use 'env', which does NOT pass paramaters. This means that you can't use -q

root@fs:/# cat /tmp/test.php
#!/usr/bin/php
<? echo "Foo\n"; ?>
root@fs:/# /tmp/test.php
Foo
root@fs:/#

The php5 supplied in centosplus DOES work as expected:

[root@wpm4l-gw etc]# cat /tmp/test.php
#!/usr/bin/php
<? echo "Foo\n"; ?>
[root@wpm4l-gw etc]# /tmp/test.php
Foo
[root@wpm4l-gw etc]# uname -a
Linux wpm4l-gw.wpm4l.com 2.6.9-42.0.3.EL #1 Fri Oct 6 05:59:54 CDT 2006 i686 i686 i386 GNU/Linux
[root@wpm4l-gw etc]# php -v
PHP 5.1.6 (cli) (built: Nov 17 2006 08:52:42)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
[root@wpm4l-gw etc]#

Note "(cli)" there. The php4 command line binary thinks it is the CGI version:

[root@sc430-3 ~]# php -v
PHP 4.3.9 (cgi) (built: Nov  7 2006 05:00:50)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
    with eAccelerator v0.9.4, Copyright (c) 2004-2005 eAccelerator, by eAccelerator
[root@sc430-3 ~]# /tmp/test.php
Content-type: text/html
X-Powered-By: PHP/4.3.9

Foo
[root@sc430-3 ~]#

--Rob