Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45515 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87249 invoked from network); 7 Sep 2009 11:23:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Sep 2009 11:23:11 -0000 X-Host-Fingerprint: 85.21.236.169 xdmitri.static.corbina.ru Received: from [85.21.236.169] ([85.21.236.169:26058] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/43-04309-E1DE4AA4 for ; Mon, 07 Sep 2009 07:23:10 -0400 Message-ID: To: internals@lists.php.net References: <20090904081640.GA28685@joeysmith.com> <753B9AED-C850-4EBA-A828-93A2542F81A2@macvicar.net> <20090904083457.GC28685@joeysmith.com> <698DE66518E7CA45812BD18E807866CE034153BA@us-ex1.zend.net> <4AA24FDB.90409@sci.fi> <4AA25E16.7040803@sci.fi> <30CAA781-B1EE-44E0-AC7B-47FF3DF48FE1@tabini.ca> <698DE66518E7CA45812BD18E807866CE03415400@us-ex1.zend.net> Date: Mon, 7 Sep 2009 15:23:10 +0400 Lines: 34 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5843 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-RFC2646: Format=Flowed; Original X-Posted-By: 85.21.236.169 Subject: Re: [PHP-DEV] shebang skipping in 5.3.0 From: dmda@yandex.ru ("jvlad") > If this is indeed a use-case for CGI then I think it's a valid argument > and we are probably better off supporting it. I did not remember shebang > works for real CGI. > There are still plenty of use-cases for running CGI (as opposed to > FastCGI) in the industry. > Question now is whether this should be done in the scanner or in the > SAPI. I'll check with Dmitry who made this change. > > Andi yes, some servers are still running php as CGI. But it is not only CGI standard involved. Well, to have a script running as a CGI, shell is executed. That's why it's necessary to have execute file permissions, that's why shebang looks like any other shell shebangs: #!whateverhandler whateverargument In other words, shebangs are SHELL INSTRUCTIONS and have nothing to do with CGI at all, or more precisely CGI is just one case where shebang is useful. With shebang any php script can be run via shell, as if it was an executable, so it is useful, not only in case of CGI. As I see it, the problem stems from fact that shebangs in php scripts are always located in the HTML part. Otherwise they would be ignored by PHP as regular comments and no problems would arise. So, special handling should be done in PHP to IGNORE shebangs. Better to have this done in lexer. Why? Because the same scripts can be run using cron (via shell), apache module, console (via shell), and CGI. just my 2c. -jv