contao / contao-manager

Contao Manager
GNU Lesser General Public License v3.0
85 stars 33 forks source link

Export and use the PHP cli path from the cli binary itself #736

Closed manuelm closed 7 months ago

manuelm commented 1 year ago

While searching the PHP cli path we use the first path which produces a valid result. However some hosters are re-writing exec paths, so the wrong (and possibly non-existent) path to the PHP cli ends in our configuration.

Instead of taking the path as-is we should rather use the path the PHP cli provides (PHP_BINARY).

aschempp commented 1 year ago

I'm not sure this will work as expected:

  1. according to the docs, PHP_BINARY should always return the binary that is currently executed – so that would already be "known"?
  2. "having" a PHP_BINARY constant would bypass the version check in your PR, that looks wrong to me. But maybe I'm overlooking something? 🤔
manuelm commented 1 year ago
  1. according to the docs, PHP_BINARY should always return the binary that is currently executed – so that would already be "known"?

In general and most setups, yes. The detected path and PHP_BINARY should match. However if the path to the executable has been silently rewritten there is a mismatch. Because we are storing the detected path instead of the path the php-cli provides, this mismatch might result in execution failure as soon as the path-rewriting does not happen anymore. e.g. the rewriting only happens if execution happens from a website, but php-cli from cron/ssh does not.

  1. "having" a PHP_BINARY constant would bypass the version check in your PR, that looks wrong to me. But maybe I'm overlooking something? thinking

I'm not sure I follow. There are no further checks which examine $path?