Bug #67587 [Com]: Redirection loop on nginx with FPM

From: Date: Mon, 07 Jul 2014 20:06:03 +0000
Subject: Bug #67587 [Com]: Redirection loop on nginx with FPM
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186507@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67587&edit=1 ID: 67587 Comment by: cweiske@php.net Reported by: cweiske@php.net Summary: Redirection loop on nginx with FPM Status: Open Type: Bug Package: PHAR related PHP Version: 5.6Git-2014-07-07 (Git) Block user comment: N Private report: N New Comment: It's actually "fpm-fcgi", not "cgi-fpm". Previous Comments: ------------------------------------------------------------------------ [2014-07-07 20:02:51] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67587&edit=1

« previous php.bugs (#186507) next »