New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Composer overrides PHP configuration and then fails because of missing extensions #5667
Comments
@renan could you show us what |
I can see that With
I think you need to either copy the files to the location or tell php to run with the php.init file that is created. |
The problem is a bit more complicated than what you summarize. For example, lets assume we call:
This gets interpreted by your php binary (cli) with its default php ini and ini dir settings. Then the xdebughandler "reloads" the process (Composer) by calling php with a custom ini file target, and sets an environment variable which specifies the new ini dir to scan. After the above has happened, we finally get to actually run the command you passed, e.g.
Important: this php process will use your default php ini file, but it still inherits the custom ini dir to scan (due to the env variable set). |
Indeed this might be the issue, would be better if we could do it all via CLI flags avoiding environment variable changes so that it doesn't propagate to child processes. Alternatively we can also remove those env vars before calling child processes but that's uglier.. |
As discussed with @alcohol running the main process as it is done by XdebugHandler and sub-processes by resetting the |
Should be fixed in latest snapshot |
Thanks guys. Sorry, I'm away from a computer for a few days and was unable to contribute to this bug fix. I'll reproduce and test when I can. |
Looks like it's fixed so no worries :) |
I can no longer reproduce the issue using latest snapshot. 👍 |
My
composer.json
:Having PHP with
xdebug
andjson
extensions installed, when running this script I get:When Xdebug is enabled composer tries to restart itself and run without any extra .ini files being loaded, which causes
json
extension to not be present. So when you have scripts that depends onjson
extension the command fails.This behavior is caused by XdebugHandler and reproducible on latest master. Probably introduced on #5580
For example using
post-update-cmd
withSensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache
, which depends onMonolog
, fails with:[RuntimeException] PHP's json extension is required to use Monolog's NormalizerFormatter
XdebugHandler
re-runs the same command with the-c
option (-c <path>|<file> Look for php.ini file in this directory
) with the directory/tmp/composer-php-empty/
, which is indeed empty.The text was updated successfully, but these errors were encountered: