Redirection loop on nginx with FPM
[2014-07-07 20:02 UTC] cweiske@php.net
Description: ------------ nginx running php via fpm gives an endless redirection loop for .phar files. $ curl -si http://phorkie.kylewm.com/phpinfo.phar/www/index.php|grep Location Location: /phpinfo.phar/www/index.php Problem is the CGI detection in Phar::webPhar() which only knows about "cgi-fcgi" and "cgi", but not about "cgi-fpm" as it is reported here: > if ((strlen(sapi_module.name) == sizeof("cgi-fcgi")-1 && !strncmp(sapi_module.name, "cgi-fcgi", sizeof("cgi-fcgi")-1)) > || (strlen(sapi_module.name) == sizeof("cgi")-1 && !strncmp(sapi_module.name, "cgi", sizeof("cgi")-1))) { http://git.php.net/?p=php-src.git;a=blob;f=ext/phar/phar_object.c;h=75aadfbc540b9929b0af563e365990c69b1ca315;hb=HEAD#l608 Seems similar to bug #53537. Test script: --------------- <?php if (file_exists('phpinfo.phar')) { unlink('phpinfo.phar'); } $phar = new Phar('phpinfo.phar'); $phar->addFromString('www/index.php', '<?php phpinfo();?>'); $phar->setStub( '<?php Phar::webPhar(null, "www/index.php"); echo "cli\n"; __HALT_COMPILER(); ?>' ); ?> Expected result: ---------------- no redirection loop. Actual result: -------------- $ curl -si http://phorkie.kylewm.com/phpinfo.phar/www/index.php|grep Location Location: /phpinfo.phar/www/index.php
[2014-07-07 20:06 UTC] cweiske@php.net
[2014-07-08 19:56 UTC] stas@php.net
[2014-07-08 19:56 UTC] stas@php.net
-Status: Open +Status: Closed
[2014-07-08 19:56 UTC] stas@php.net
[2014-07-08 19:56 UTC] stas@php.net
[2014-07-09 10:08 UTC] dmitry@php.net
[2014-07-09 10:08 UTC] dmitry@php.net
[2014-07-09 10:08 UTC] dmitry@php.net
[2014-07-21 09:31 UTC] ab@php.net
[2014-07-21 09:31 UTC] ab@php.net
[2014-07-21 10:02 UTC] ab@php.net
[2014-07-21 10:02 UTC] ab@php.net
[2014-07-21 10:02 UTC] ab@php.net
[2014-07-30 09:52 UTC] tyrael@php.net
[2014-07-30 09:52 UTC] tyrael@php.net
[2014-10-07 23:14 UTC] stas@php.net
[2014-10-07 23:25 UTC] stas@php.net
[2016-07-20 11:40 UTC] davey@php.net