From:             [EMAIL PROTECTED]
Operating system: Solaris 2.6
PHP version:      4.0.4pl1
PHP Bug Type:     Other web server
Bug description:  #!/path/php at top of CGI script appears in output (Netscape 
Enterprise Server)

Solaris 2.6; Netscape Enterprise Server 3.6.
Php interpreter built for installation outside Webserver document tree, with leading 
#! line in CGI script used to activate interpreter. This line appears as first line of 
the generated HTML. 

N.E.S. config statements:
 In mime.types:
  type=magnus-internal/cgi exts=php4
 In obj.conf:
  <Object name="default">
  .
  .
  Service fn="send-cgi" type="magnus-internal/cgi"
  .
  </Object>

This appears to be same situation reported for other webservers in bug reports 8506 
and 8782.

sapi/cgi/cgi_main.c has code to check and skip leading #! line, but it is controlled 
by previous "if" clause which is present to set up reading interpreter input from 
script file in cgi environment. Making #! checks whenever input is from file fixes 
problem under CGI and is OK as well using same interpreter in standalone mode.

Suggested diff based on 4.0.4pl1 source (in effect just deletes an "else"):

*** sapi/cgi/cgi_main.c.orig    Sun Dec  3 02:09:13 2000
--- sapi/cgi/cgi_main.c Wed Jan 24 16:39:34 2001
***************
*** 719,725 ****
                        return FAILURE;
                }
                file_handle.filename = argv0;
!       } else if (file_handle.handle.fp && file_handle.handle.fp!=stdin) {
                /* #!php support */
                c = fgetc(file_handle.handle.fp);
                if (c == '#') {
--- 719,726 ----
                        return FAILURE;
                }
                file_handle.filename = argv0;
!       }
!       if (file_handle.handle.fp && file_handle.handle.fp!=stdin) {
                /* #!php support */
                c = fgetc(file_handle.handle.fp);
                if (c == '#') {





-- 
Edit Bug report at: http://bugs.php.net/?id=8898&edit=1



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to