cgi.check_shebang_line default value

php.internals

Dmitry Stogov

19 years ago
Hi, The following patch adds new INI directive for CGI SAPI. It may enable/disable check for shebang line (#! /usr/bin/php) and as result improve performance of FastCGI. I set the default value for this directive to 1 (that means check file on each request) to not break previous behavior. However may be it is better to set default value to 0. That means break previous behavior but improve performance by default. Any suggestions? Thanks. Dmitry.

Ilia A.

19 years ago
I think people who want the performance can disable the check, but we should not break BC, certainly not at a patch level release. On 14-Nov-06, at 5:42 AM, Dmitry Stogov wrote:
> Hi, > > The following patch adds new INI directive for CGI SAPI. > It may enable/disable check for shebang line (#! /usr/bin/php) and > as result > improve performance of FastCGI. > > I set the default value for this directive to 1 (that means check > file on > each request) to not break previous behavior. > However may be it is better to set default value to 0. That means > break > previous behavior but improve performance by default. > > Any suggestions? > > Thanks. Dmitry. > >> -----Original Message----- >> From: Dmitry Stogov [mailto:dmitry@php.net] >> Sent: Tuesday, November 14, 2006 1:32 PM >> To: php-cvs@lists.php.net >> Subject: [PHP-CVS] cvs: php-src /sapi/cgi cgi_main.c >> >> >> dmitry Tue Nov 14 10:32:11 2006 UTC >> >> Modified files: >> /php-src/sapi/cgi cgi_main.c >> Log: >> cgi.* and fastcgi.* directives are moved to INI subsystem. >> The new directive cgi.check_shebang_line can be used to >> ommiting checnk for "#! /usr/bin/php" line. >> >> >> >> <dmitry-20061114103211.txt> > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php
Ilia Alshanetsky

Derick Rethans

19 years ago
On Tue, 14 Nov 2006, Ilia Alshanetsky wrote:
> I think people who want the performance can disable the check, but we should > not break BC, certainly not at a patch level release.
I agree there. Derick

Marcus Börger

19 years ago
Hello Dmitry, i thought we were avoiding new inisettings. And also having a new INI option takes some time. So is the result really faster? best regards marcus Tuesday, November 14, 2006, 11:42:08 AM, you wrote:
> Hi,
> The following patch adds new INI directive for CGI SAPI. > It may enable/disable check for shebang line (#! /usr/bin/php) and as result > improve performance of FastCGI.
> I set the default value for this directive to 1 (that means check file on > each request) to not break previous behavior. > However may be it is better to set default value to 0. That means break > previous behavior but improve performance by default.
> Any suggestions?
> Thanks. Dmitry.
>> -----Original Message----- >> From: Dmitry Stogov [mailto:dmitry@php.net] >> Sent: Tuesday, November 14, 2006 1:32 PM >> To: php-cvs@lists.php.net >> Subject: [PHP-CVS] cvs: php-src /sapi/cgi cgi_main.c >> >> >> dmitry Tue Nov 14 10:32:11 2006 UTC >> >> Modified files: >> /php-src/sapi/cgi cgi_main.c >> Log: >> cgi.* and fastcgi.* directives are moved to INI subsystem. >> The new directive cgi.check_shebang_line can be used to >> ommiting checnk for "#! /usr/bin/php" line. >> >> >>
Best regards, Marcus

Stanislav Malyshev

19 years ago
> i thought we were avoiding new inisettings. And also having a new INI > option takes some time. So is the result really faster?
Saves FS access per request. New INI cost is minimal. Now, I think avoiding INI makes most sense for INIs that change app behavior. This INI changes almost nothing except for allowing you to make things faster by removing check you don't use or alternatively enable check for some legacy script which uses #! where it really has no meaning but it always worked that way.
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/

Marcus Börger

19 years ago
Hello Stanislav, why not use a command-line switch for itinstead an INI option? best regards marcus Tuesday, November 14, 2006, 10:53:26 PM, you wrote:
>> i thought we were avoiding new inisettings. And also having a new INI >> option takes some time. So is the result really faster?
> Saves FS access per request. New INI cost is minimal. Now, I think > avoiding INI makes most sense for INIs that change app behavior. This > INI changes almost nothing except for allowing you to make things faster > by removing check you don't use or alternatively enable check for some > legacy script which uses #! where it really has no meaning but it always > worked that way. > -- > Stanislav Malyshev, Zend Products Engineer > stas@zend.com http://www.zend.com/
Best regards, Marcus

Pierre Joye

19 years ago
Hello, On 11/14/06, Marcus Boerger <helly@php.net> wrote:
> Hello Stanislav, > > why not use a command-line switch for itinstead an INI option?
An ini setting is perfectly valid in this case, it can/should be set to off in 5.2.x and enabled in head. A command line options is really a bad alternative. --Pierre

Stanislav Malyshev

19 years ago
> why not use a command-line switch for itinstead an INI option?
Because FCGI can't use command-line switches in many situations. And even if it's allowed it's usually harder to set and easier to miss.
-- Stanislav Malyshev, Zend Products Engineer stas@zend.com http://www.zend.com/

Andi Gutmans

19 years ago
I think in this case it makes very much sense. It will allow 99.9% of the people who don't use shebang for Web apps to gain better performance (less system calls which is important on highly loaded servers) and allow people to keep full compatibility if they happen to be odd and use shebang in Web apps. This is absolutely what we've been using INI for in the past. We can just keep this on by default so that we don't break BC, although I think it'd be good to have it off in php.ini-recommended. If people very much disagree we can just keep it on by default always but that's a waste in my opinion. Andi

Marcus Börger

19 years ago
Hello Andi, all in all i would actually prefer to have no shebang support in cgi startin gwith 6 and stick to what we have for 5.x. For Later we have CLI anyway. best regards marcus Wednesday, November 15, 2006, 12:03:54 AM, you wrote:
> I think in this case it makes very much sense. It will allow 99.9% of the > people who don't use shebang for Web apps to gain better performance (less > system calls which is important on highly loaded servers) and allow people > to keep full compatibility if they happen to be odd and use shebang in Web > apps. This is absolutely what we've been using INI for in the past.
> We can just keep this on by default so that we don't break BC, although I > think it'd be good to have it off in php.ini-recommended. If people very > much disagree we can just keep it on by default always but that's a waste in > my opinion.
> Andi
>> -----Original Message----- >> From: Marcus Boerger [mailto:helly@php.net] >> Sent: Tuesday, November 14, 2006 12:15 PM >> To: Dmitry Stogov >> Cc: internals@lists.php.net; Andi Gutmans; Stanislav Malyshev >> Subject: Re: [PHP-DEV] cgi.check_shebang_line default value >> >> Hello Dmitry, >> >> i thought we were avoiding new inisettings. And also having >> a new INI option takes some time. So is the result really faster? >> >> best regards >> marcus >> >> Tuesday, November 14, 2006, 11:42:08 AM, you wrote: >> >> > Hi, >> >> > The following patch adds new INI directive for CGI SAPI. >> > It may enable/disable check for shebang line (#! >> /usr/bin/php) and as >> > result improve performance of FastCGI. >> >> > I set the default value for this directive to 1 (that means >> check file >> > on each request) to not break previous behavior. >> > However may be it is better to set default value to 0. That means >> > break previous behavior but improve performance by default. >> >> > Any suggestions? >> >> > Thanks. Dmitry. >> >> >> -----Original Message----- >> >> From: Dmitry Stogov [mailto:dmitry@php.net] >> >> Sent: Tuesday, November 14, 2006 1:32 PM >> >> To: php-cvs@lists.php.net >> >> Subject: [PHP-CVS] cvs: php-src /sapi/cgi cgi_main.c >> >> >> >> >> >> dmitry Tue Nov 14 10:32:11 2006 UTC >> >> >> >> Modified files: >> >> /php-src/sapi/cgi cgi_main.c >> >> Log: >> >> cgi.* and fastcgi.* directives are moved to INI subsystem. >> >> The new directive cgi.check_shebang_line can be used to ommiting >> >> checnk for "#! /usr/bin/php" line. >> >> >> >> >> >> >> >> >> >> Best regards, >> Marcus >>
Best regards, Marcus

Andi Gutmans

19 years ago
Marcus, If it really makes you feel better we can not list the INI parameter in php.ini and then there's no difference compared to what we have today. People could find it in the manual. I really don't see any advantages to that and it's best to improve this issues asap. People will be sticking to PHP 5 for a loooooooong time to come and we will continue to support those users as well as we can. Andi

Dmitry Stogov

19 years ago
The patch allow save one read() and one seek() syscall for each request. On hello.php (<?php echo "Hello world!\n";?>) I got 430 req/sec without patch and 530 req/sec with patch. I think this INI directive is not a big cost for ~20% speedup. The test was done without concurency (ab -n1000 -c1). Thanks. Dmitry.

Dmitry Stogov

19 years ago
Seems I got such good results because of measuring mistake. Now I see only 4% speedup. :( Dmitry.

Richard Lynch

19 years ago
On Tue, November 14, 2006 4:42 am, Dmitry Stogov wrote:
> The following patch adds new INI directive for CGI SAPI. > It may enable/disable check for shebang line (#! /usr/bin/php) and as > result > improve performance of FastCGI. > > I set the default value for this directive to 1 (that means check file > on > each request) to not break previous behavior. > However may be it is better to set default value to 0. That means > break > previous behavior but improve performance by default.
For sure, default to non-BC-breaking setting of 1. That shouldn't even be a question. :-) Is another .ini setting worth 4% increase in performance? Not to me, but I'm not the guy that needs 4% CGI improvement on any servers I run :-) But another .ini setting doesn't bother me as it does some, so I'm fine with that. Killing shebang entirely in 6.0 --- I dunno... Seems like there's probably a lot of cron jobs out there relying on it, that nobody will think of when you ask them, but as soon as you pull the plug, you're gonna get a zillion complaints... And as far as not including it in the php.ini, that seems to me like it would cause more problems than solutions. It ends up seeming to php.ini readers like an "Undocumented Feature" or something, and you just generate more questions than adding one more setting to php.ini
-- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?