[PHP-DEV] Bug #14170 Updated: #!/path/to/php shows up on every php script

2001-11-22 Thread sniper

ID: 14170
Updated by: sniper
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Duplicate
Bug Type: *General Issues
Operating System: Linux RH 7.1
PHP Version: 4.0CVS-2001-11-22
New Comment:

Duplicate of #9041

Previous Comments:


[2001-11-22 13:00:33] [EMAIL PROTECTED]

No, the point is if you run a script as a conventional CGI-script (just like you can 
run shell scripts through CGI), the line with #!/path/to/php shows up...
Normally, if you run PHP as CGI via Apache, some lines in httpd.conf say that *.php 
should be parsed through /usr/local/bin/php
It's not necessary to use that. Alternatively, you could use #!/path/to/php if the 
server has (plain) CGI enabled. It's usefull i.e. if you have built a dev-version of 
PHP somewhere and don't want to install it, but just use it for a few scripts to test 
new functionality.

And about magic stuff: the patch which hides #! when running via the command line, has 
already been commited... isn't that magic too?


Workaround: enable output buffering in your php.ini and start your scripts with 
ob_end_clean();.



[2001-11-22 12:23:30] [EMAIL PROTECTED]

Err ... whats the point of using this in a CGI?

I understand, some kind of portability probably (running it from CMD and CGI) but this 
is some dirty magic stuff IMHO. 

Its just a text file which gets processed and when it starts with #! then it starts 
with #! and therefore the output shall be #!.

However, I've an open mind for that :)



[2001-11-22 10:54:56] [EMAIL PROTECTED]

Sounds like a misconfiguration to me.



[2001-11-22 10:50:49] [EMAIL PROTECTED]

Nope, this bug only shows up if you run it through CGI. Running from the command-line 
works fine.



[2001-11-22 10:35:43] [EMAIL PROTECTED]

Nope, this bug only shows up if you run it through CGI. Running from the command-line 
works fine.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/?id=14170


Edit this bug report at http://bugs.php.net/?id=14170&edit=1


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #14170 Updated: #!/path/to/php shows up on every php script

2001-11-22 Thread sander

ID: 14170
Updated by: sander
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: *General Issues
Operating System: Linux RH 7.1
PHP Version: 4.0CVS-2001-11-22
New Comment:

No, the point is if you run a script as a conventional CGI-script (just like you can 
run shell scripts through CGI), the line with #!/path/to/php shows up...
Normally, if you run PHP as CGI via Apache, some lines in httpd.conf say that *.php 
should be parsed through /usr/local/bin/php
It's not necessary to use that. Alternatively, you could use #!/path/to/php if the 
server has (plain) CGI enabled. It's usefull i.e. if you have built a dev-version of 
PHP somewhere and don't want to install it, but just use it for a few scripts to test 
new functionality.

And about magic stuff: the patch which hides #! when running via the command line, has 
already been commited... isn't that magic too?


Workaround: enable output buffering in your php.ini and start your scripts with 
ob_end_clean();.

Previous Comments:


[2001-11-22 12:23:30] [EMAIL PROTECTED]

Err ... whats the point of using this in a CGI?

I understand, some kind of portability probably (running it from CMD and CGI) but this 
is some dirty magic stuff IMHO. 

Its just a text file which gets processed and when it starts with #! then it starts 
with #! and therefore the output shall be #!.

However, I've an open mind for that :)



[2001-11-22 10:54:56] [EMAIL PROTECTED]

Sounds like a misconfiguration to me.



[2001-11-22 10:50:49] [EMAIL PROTECTED]

Nope, this bug only shows up if you run it through CGI. Running from the command-line 
works fine.



[2001-11-22 10:35:43] [EMAIL PROTECTED]

Nope, this bug only shows up if you run it through CGI. Running from the command-line 
works fine.



[2001-11-22 04:10:06] [EMAIL PROTECTED]

Cannot reproduce this:

$ cat test.php 
#!/home/mfischer/php4/bin/php -q


mfischer@debian:~$ ./test.php 
test
mfischer@debian:~$ php -f test.php 
test
mfischer@debian:~$ php -v
4.2.0-dev





The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/?id=14170


Edit this bug report at http://bugs.php.net/?id=14170&edit=1


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #14170 Updated: #!/path/to/php shows up on every php script

2001-11-22 Thread mfischer

ID: 14170
Updated by: mfischer
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: *General Issues
Operating System: Linux RH 7.1
PHP Version: 4.0CVS-2001-11-22
New Comment:

Err ... whats the point of using this in a CGI?

I understand, some kind of portability probably (running it from CMD and CGI) but this 
is some dirty magic stuff IMHO. 

Its just a text file which gets processed and when it starts with #! then it starts 
with #! and therefore the output shall be #!.

However, I've an open mind for that :)

Previous Comments:


[2001-11-22 10:54:56] [EMAIL PROTECTED]

Sounds like a misconfiguration to me.



[2001-11-22 10:50:49] [EMAIL PROTECTED]

Nope, this bug only shows up if you run it through CGI. Running from the command-line 
works fine.



[2001-11-22 10:35:43] [EMAIL PROTECTED]

Nope, this bug only shows up if you run it through CGI. Running from the command-line 
works fine.



[2001-11-22 04:10:06] [EMAIL PROTECTED]

Cannot reproduce this:

$ cat test.php 
#!/home/mfischer/php4/bin/php -q


mfischer@debian:~$ ./test.php 
test
mfischer@debian:~$ php -f test.php 
test
mfischer@debian:~$ php -v
4.2.0-dev





[2001-11-22 03:49:34] [EMAIL PROTECTED]

#!/path/to/php shows up at the top of every php script

-- script --
#!/path/to/php

-- /script --

Running latest php4 CVS as CGI, Apache 1.3.20, no modules

A similar bug was reported in the past (#9041, #8898, #8782) but I'm running the 
latest CVS.

The following modification seemed to do the trick:

? .cgi_main.c.swp
? cdig.diff
Index: cgi_main.c
===
RCS file: /repository/php4/sapi/cgi/cgi_main.c,v
retrieving revision 1.138
diff -u -r1.138 cgi_main.c
--- cgi_main.c  11 Nov 2001 23:11:23 -  1.138
+++ cgi_main.c  22 Nov 2001 08:09:48 -
@@ -729,18 +729,18 @@
}
file_handle.filename = argv0;
file_handle.opened_path = expand_filepath(argv0, NULL 
TSRMLS_CC);
-   } else if (retval == SUCCESS) {
-   /* #!php support */
-   c = fgetc(file_handle.handle.fp);
-   if (c == '#') {
-   while (c != 10 && c != 13) {
-   c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
-   }
-   CG(zend_lineno)++;
-   } else {
-   rewind(file_handle.handle.fp);
+   }
+   /* #!php support */
+   c = fgetc(file_handle.handle.fp);
+   if (c == '#') {
+   while (c != 10 && c != 13) {
+   c = fgetc(file_handle.handle.fp);   /* skip to end 
+of line */
}
+   CG(zend_lineno)++;
+   } else {
+   rewind(file_handle.handle.fp);
}
+

switch (behavior) {
case PHP_MODE_STANDARD:





Edit this bug report at http://bugs.php.net/?id=14170&edit=1


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #14170 Updated: #!/path/to/php shows up on every php script

2001-11-22 Thread jmoore

ID: 14170
Updated by: jmoore
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: *General Issues
Operating System: Linux RH 7.1
PHP Version: 4.0CVS-2001-11-22
New Comment:

Sounds like a misconfiguration to me.

Previous Comments:


[2001-11-22 10:50:49] [EMAIL PROTECTED]

Nope, this bug only shows up if you run it through CGI. Running from the command-line 
works fine.



[2001-11-22 10:35:43] [EMAIL PROTECTED]

Nope, this bug only shows up if you run it through CGI. Running from the command-line 
works fine.



[2001-11-22 04:10:06] [EMAIL PROTECTED]

Cannot reproduce this:

$ cat test.php 
#!/home/mfischer/php4/bin/php -q


mfischer@debian:~$ ./test.php 
test
mfischer@debian:~$ php -f test.php 
test
mfischer@debian:~$ php -v
4.2.0-dev





[2001-11-22 03:49:34] [EMAIL PROTECTED]

#!/path/to/php shows up at the top of every php script

-- script --
#!/path/to/php

-- /script --

Running latest php4 CVS as CGI, Apache 1.3.20, no modules

A similar bug was reported in the past (#9041, #8898, #8782) but I'm running the 
latest CVS.

The following modification seemed to do the trick:

? .cgi_main.c.swp
? cdig.diff
Index: cgi_main.c
===
RCS file: /repository/php4/sapi/cgi/cgi_main.c,v
retrieving revision 1.138
diff -u -r1.138 cgi_main.c
--- cgi_main.c  11 Nov 2001 23:11:23 -  1.138
+++ cgi_main.c  22 Nov 2001 08:09:48 -
@@ -729,18 +729,18 @@
}
file_handle.filename = argv0;
file_handle.opened_path = expand_filepath(argv0, NULL 
TSRMLS_CC);
-   } else if (retval == SUCCESS) {
-   /* #!php support */
-   c = fgetc(file_handle.handle.fp);
-   if (c == '#') {
-   while (c != 10 && c != 13) {
-   c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
-   }
-   CG(zend_lineno)++;
-   } else {
-   rewind(file_handle.handle.fp);
+   }
+   /* #!php support */
+   c = fgetc(file_handle.handle.fp);
+   if (c == '#') {
+   while (c != 10 && c != 13) {
+   c = fgetc(file_handle.handle.fp);   /* skip to end 
+of line */
}
+   CG(zend_lineno)++;
+   } else {
+   rewind(file_handle.handle.fp);
}
+

switch (behavior) {
case PHP_MODE_STANDARD:





Edit this bug report at http://bugs.php.net/?id=14170&edit=1


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #14170 Updated: #!/path/to/php shows up on every php script

2001-11-22 Thread sander

ID: 14170
Updated by: sander
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: *General Issues
Operating System: Linux RH 7.1
PHP Version: 4.0CVS-2001-11-22
New Comment:

Nope, this bug only shows up if you run it through CGI. Running from the command-line 
works fine.

Previous Comments:


[2001-11-22 10:35:43] [EMAIL PROTECTED]

Nope, this bug only shows up if you run it through CGI. Running from the command-line 
works fine.



[2001-11-22 04:10:06] [EMAIL PROTECTED]

Cannot reproduce this:

$ cat test.php 
#!/home/mfischer/php4/bin/php -q


mfischer@debian:~$ ./test.php 
test
mfischer@debian:~$ php -f test.php 
test
mfischer@debian:~$ php -v
4.2.0-dev





[2001-11-22 03:49:34] [EMAIL PROTECTED]

#!/path/to/php shows up at the top of every php script

-- script --
#!/path/to/php

-- /script --

Running latest php4 CVS as CGI, Apache 1.3.20, no modules

A similar bug was reported in the past (#9041, #8898, #8782) but I'm running the 
latest CVS.

The following modification seemed to do the trick:

? .cgi_main.c.swp
? cdig.diff
Index: cgi_main.c
===
RCS file: /repository/php4/sapi/cgi/cgi_main.c,v
retrieving revision 1.138
diff -u -r1.138 cgi_main.c
--- cgi_main.c  11 Nov 2001 23:11:23 -  1.138
+++ cgi_main.c  22 Nov 2001 08:09:48 -
@@ -729,18 +729,18 @@
}
file_handle.filename = argv0;
file_handle.opened_path = expand_filepath(argv0, NULL 
TSRMLS_CC);
-   } else if (retval == SUCCESS) {
-   /* #!php support */
-   c = fgetc(file_handle.handle.fp);
-   if (c == '#') {
-   while (c != 10 && c != 13) {
-   c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
-   }
-   CG(zend_lineno)++;
-   } else {
-   rewind(file_handle.handle.fp);
+   }
+   /* #!php support */
+   c = fgetc(file_handle.handle.fp);
+   if (c == '#') {
+   while (c != 10 && c != 13) {
+   c = fgetc(file_handle.handle.fp);   /* skip to end 
+of line */
}
+   CG(zend_lineno)++;
+   } else {
+   rewind(file_handle.handle.fp);
}
+

switch (behavior) {
case PHP_MODE_STANDARD:





Edit this bug report at http://bugs.php.net/?id=14170&edit=1


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #14170 Updated: #!/path/to/php shows up on every php script

2001-11-22 Thread sander

ID: 14170
Updated by: sander
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: *General Issues
Operating System: Linux RH 7.1
PHP Version: 4.0CVS-2001-11-22
New Comment:

Nope, this bug only shows up if you run it through CGI. Running from the command-line 
works fine.

Previous Comments:


[2001-11-22 04:10:06] [EMAIL PROTECTED]

Cannot reproduce this:

$ cat test.php 
#!/home/mfischer/php4/bin/php -q


mfischer@debian:~$ ./test.php 
test
mfischer@debian:~$ php -f test.php 
test
mfischer@debian:~$ php -v
4.2.0-dev





[2001-11-22 03:49:34] [EMAIL PROTECTED]

#!/path/to/php shows up at the top of every php script

-- script --
#!/path/to/php

-- /script --

Running latest php4 CVS as CGI, Apache 1.3.20, no modules

A similar bug was reported in the past (#9041, #8898, #8782) but I'm running the 
latest CVS.

The following modification seemed to do the trick:

? .cgi_main.c.swp
? cdig.diff
Index: cgi_main.c
===
RCS file: /repository/php4/sapi/cgi/cgi_main.c,v
retrieving revision 1.138
diff -u -r1.138 cgi_main.c
--- cgi_main.c  11 Nov 2001 23:11:23 -  1.138
+++ cgi_main.c  22 Nov 2001 08:09:48 -
@@ -729,18 +729,18 @@
}
file_handle.filename = argv0;
file_handle.opened_path = expand_filepath(argv0, NULL 
TSRMLS_CC);
-   } else if (retval == SUCCESS) {
-   /* #!php support */
-   c = fgetc(file_handle.handle.fp);
-   if (c == '#') {
-   while (c != 10 && c != 13) {
-   c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
-   }
-   CG(zend_lineno)++;
-   } else {
-   rewind(file_handle.handle.fp);
+   }
+   /* #!php support */
+   c = fgetc(file_handle.handle.fp);
+   if (c == '#') {
+   while (c != 10 && c != 13) {
+   c = fgetc(file_handle.handle.fp);   /* skip to end 
+of line */
}
+   CG(zend_lineno)++;
+   } else {
+   rewind(file_handle.handle.fp);
}
+

switch (behavior) {
case PHP_MODE_STANDARD:





Edit this bug report at http://bugs.php.net/?id=14170&edit=1


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #14170 Updated: #!/path/to/php shows up on every php script

2001-11-22 Thread mfischer

ID: 14170
Updated by: mfischer
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: *General Issues
Operating System: Linux RH 7.1
PHP Version: 4.0CVS-2001-11-22
New Comment:

Cannot reproduce this:

$ cat test.php 
#!/home/mfischer/php4/bin/php -q


mfischer@debian:~$ ./test.php 
test
mfischer@debian:~$ php -f test.php 
test
mfischer@debian:~$ php -v
4.2.0-dev



Previous Comments:


[2001-11-22 03:49:34] [EMAIL PROTECTED]

#!/path/to/php shows up at the top of every php script

-- script --
#!/path/to/php

-- /script --

Running latest php4 CVS as CGI, Apache 1.3.20, no modules

A similar bug was reported in the past (#9041, #8898, #8782) but I'm running the 
latest CVS.

The following modification seemed to do the trick:

? .cgi_main.c.swp
? cdig.diff
Index: cgi_main.c
===
RCS file: /repository/php4/sapi/cgi/cgi_main.c,v
retrieving revision 1.138
diff -u -r1.138 cgi_main.c
--- cgi_main.c  11 Nov 2001 23:11:23 -  1.138
+++ cgi_main.c  22 Nov 2001 08:09:48 -
@@ -729,18 +729,18 @@
}
file_handle.filename = argv0;
file_handle.opened_path = expand_filepath(argv0, NULL 
TSRMLS_CC);
-   } else if (retval == SUCCESS) {
-   /* #!php support */
-   c = fgetc(file_handle.handle.fp);
-   if (c == '#') {
-   while (c != 10 && c != 13) {
-   c = fgetc(file_handle.handle.fp);   /* 
skip to end of line */
-   }
-   CG(zend_lineno)++;
-   } else {
-   rewind(file_handle.handle.fp);
+   }
+   /* #!php support */
+   c = fgetc(file_handle.handle.fp);
+   if (c == '#') {
+   while (c != 10 && c != 13) {
+   c = fgetc(file_handle.handle.fp);   /* skip to end 
+of line */
}
+   CG(zend_lineno)++;
+   } else {
+   rewind(file_handle.handle.fp);
}
+

switch (behavior) {
case PHP_MODE_STANDARD:





Edit this bug report at http://bugs.php.net/?id=14170&edit=1


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]