将ext-stackdriver_debugger添加到作曲家以在Google App Engine中启用StackDriver调试

时间:2018-11-04 22:51:28

标签: google-app-engine composer-php stackdriver

我正在按照此页面上的步骤操作:https://cloud.google.com/debugger/docs/setup/php

我想为App Engine灵活环境(PHP 7.2)设置调试。

第3步表示要使用以下命令添加Add the Stackdriver Debugger PHP extension via your composer.json file:

composer require ext-stackdriver_debugger:*

但是,当我运行它时,找不到该包:

[InvalidArgumentException]                                                                                                                                                   
  Could not find a matching version of package ext-stackdriver_debugger. Check the 
  package spelling, your version constraint and that the package is available in a
  stability which matches your minimum-stability (stable).  

如何成功完成步骤3?

1 个答案:

答案 0 :(得分:1)

此类错误通常表示composer命令使用的PHP版本未启用扩展/模块。确保您已在PHP CLI使用的php.ini中启用了模块。或者,您可以显式使用特定的PHP版本来运行composer命令:

/usr/bin/php7.2 composer require ext-stackdriver_debugger:*

在最坏的情况下,您可以尝试将扩展名手动添加到composer.json

"require": {
    "ext-stackdriver_debugger": "*",
    ...
},

并使用--ignore-platform-reqs打开composer updatecomposer install。或者只是忽略此步骤-要求PHP扩展不会给您带来任何真正的好处,只是阻止在没有此扩展的服务器上安装软件包。您无需将PHP扩展名添加到composer.json即可使用。