ID: 49182
Comment by: salsi at icosaedro dot it
Reported By: salsi at icosaedro dot it
Status: Feedback
Bug Type: CGI related
Operating System: Slackware 12.0
PHP Version: 5.3SVN-2009-08-06 (SVN)
New Comment:
I also noted that the CGI version considers the shebang line as
"generated output", and then namespace declarations are not allowed. For
example:
#!/usr/local/php-5.3.0/bin/php-cgi -c /home/salsi/php530/php.ini
<?php
namespace foo\bar;
?>
tells
Fatal error: Namespace declaration statement has to be the very first
statement in the script in /home/salsi/php530/test.php on line 3
The CLI version /usr/local/php-5.3.0/bin/php instead works as expected
and the shebang line is not displayed.
Previous Comments:
------------------------------------------------------------------------
[2009-08-06 20:45:08] salsi at icosaedro dot it
I'm using Apache 2.2.8 + suexec without any support for PHP (it
executes only CGI programs) and all worked well with PHP 5.2.5 I used
until now. But this should not care, as in my opinion the shebang should
not be displayed once the script has been detected to be executed as a
program.
I configured PHP as follows:
./configure \
--disable-all \
--prefix=/usr/local/php-5.3.0 \
--exec-prefix=/usr/local/php-5.3.0 \
--disable-rpath \
--disable-ipv6 \
--enable-ftp=shared \
--enable-sockets=shared \
--enable-tokenizer \
--with-gnu-ld=shared \
--with-pgsql=shared \
--enable-session \
--enable-posix \
--with-pcre-regex \
--enable-mbstring=all \
--enable-mbregex \
--enable-libxml \
--enable-xml \
--enable-dom \
--enable-pdo
I can also confirm that with the old version of PHP the shebang line
did not came out under Apache and neither did it under the command line.
------------------------------------------------------------------------
[2009-08-06 20:01:38] [email protected]
What webserver? How did you configure PHP into it?
------------------------------------------------------------------------
[2009-08-06 18:59:41] salsi at icosaedro dot it
Description:
------------
Executing any PHP CGI script always results in the shebang line being
displayed along the correct HTML code of the WEB page.
This happens with and without the --enable-discard-path configuration
flag (although I'm not really sure this flag be realted to the issue or
not).
Reproduce code:
---------------
#!/usr/local/php-5.3.0/bin/php-cgi -c /home/salsi/php530/php.ini
<?php
echo PHP_VERSION;
?>
Expected result:
----------------
$ ./shebang.php
X-Powered-By: PHP/5.3.1-dev
Content-type: text/html
5.3.1-dev
Actual result:
--------------
$ ./shebang.php
X-Powered-By: PHP/5.3.1-dev
Content-type: text/html
#!/usr/local/php-5.3.0/bin/php-cgi -c /home/salsi/php530/php.ini
5.3.1-dev
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49182&edit=1