#49182 [Com]: PHP CGI always outputs the shebang line

2009-09-04 Thread niklas at narhinen dot net
 ID:   49182
 Comment by:   niklas at narhinen dot net
 Reported By:  salsi at icosaedro dot it
 Status:   No Feedback
 Bug Type: CGI related
 Operating System: Slackware 12.0
 PHP Version:  5.3SVN-2009-08-06 (SVN)
 New Comment:

Hi, using php 5.3.0.

my script is:

#!/path/to/php-cgi
?php
phpinfo();
?

and it prints #!/path/to/php-cgi on top of the normal phpinfo

Running Debian Etch

This bug needs to be reopened..


Previous Comments:


[2009-08-14 01:00:02] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to Open.



[2009-08-09 09:51:26] salsi at icosaedro dot it

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.



[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] j...@php.net

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=49182edit=1



#49182 [Com]: PHP CGI always outputs the shebang line

2009-08-09 Thread salsi at icosaedro dot it
 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] j...@php.net

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=49182edit=1



#49182 [Com]: PHP CGI always outputs the shebang line

2009-08-06 Thread salsi at icosaedro dot it
 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'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.


Previous Comments:


[2009-08-06 20:01:38] j...@php.net

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=49182edit=1