Bug #49664

Setup detects wrong PHP binary when running via fpm

Added by Georg Großberger about 2 years ago. Updated over 1 year ago.

Status:Resolved Start date:2013-07-04
Priority:Must have Due date:
Assigned To:Robert Lemke % Done:

100%

Category:-
Target version:Base Distribution - 1.0 beta 1

Description

When the webserver pumps the request to a fcgi PHP set up via FPM, the PHP_BINARY constant contains ".../php-fpm". This passes the "version check", but cannot run anything else, resulting in an error at the very first screen.

The solution is in Core\RequestHandler, in the checkPhpBinary function. Adding this, right after the "file_exists" check and before the "exec" command, helps

if (substr($phpBinaryPathAndFilename, -4) === '-fpm' && php_sapi_name() === 'php-fcgi') {
    return $this->checkPhpBinary(substr($phpBinaryPathAndFilename, 0, -4));
}

Will provide a patch soon

Associated revisions

Revision e840857b
Added by Robert Lemke about 2 years ago

[BUGFIX] PHP binary is wrongly detected for PHP-FPM

This solves an issue of the setup request handler which wrongly detects the path
and filename of the PHP binary if the user is running a setup with PHP FPM.

We now only use PHP_BINARY as a reference if it points to a PHP binary residing
in PHP_BINDIR because it usually contains the path and filename of the PHP binary
which is currently used opposed to the one used for CLI.

PHP_BINARY might, for example, be "/opt/local/sbin/php54-fpm" while PHP_BINDIR
contains "/opt/local/bin" and the actual CLI binary is "/opt/local/bin/php".

Fixes: #49664
Change-Id: I47adca345cbef7b14e85e35255a83c7e4a4c093c

History

#1 Updated by Rens Admiraal about 2 years ago

just a note: the check for substr(..., -4) is wrong, as my PHP_BINARY contains '/opt/local/sbin/php-fpm54' for example, probably a strpos on '-fpm' is the better way (although still error prone in edge cases)

and related: https://review.typo3.org/#/c/22027/1

#2 Updated by Gerrit Code Review about 2 years ago

  • Status changed from New to Under Review

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22027

#3 Updated by Aske Ertmann about 2 years ago

  • Priority changed from Should have to Must have
  • Target version set to 1.0 beta 1

#4 Updated by Aske Ertmann about 2 years ago

  • Assigned To set to Robert Lemke

#5 Updated by Gerrit Code Review about 2 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22027

#6 Updated by Anonymous about 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF