安装 Google Adwords Api 库(使用 docker)

Installing Google Adwords Api Library (using docker)

关于安装库的 Google 文档,可在此处找到:https://github.com/googleads/googleads-php-lib/blob/master/README.md#getting-started, instructs us to copy adsapi_php.ini, as constructed here: https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/adsapi_php.ini,到您的主目录。

我在 .ini 中填写了必要的变量,并且我正在使用 docker,所以我将这个文件放在我的容器中 /var/www/home/node/,当我 运行命令 composer require googleads/googleads-php-lib 我在命令提示符中收到以下错误:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for googleads/googleads-php-lib ^37.1 -> satisfiable by googleads/googleads-php-lib[37.1.0].
    - googleads/googleads-php-lib 37.1.0 requires ext-soap * -> the requested PHP extension soap is missing from your system.

  To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/etc/php/php.ini
    - /usr/local/etc/php/conf.d/adsapi_php.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.

我认为问题是我的 adsapi_php.ini 只是在错误的位置,因为它包含我认为避免上述问题所必需的内容,但我已经尝试将它放在几个不同的地方,但我总是得到同样的错误。

如有任何帮助,我们将不胜感激!

只需尝试在 docker 中编辑 php.ini(docker exec -t {container} bashand enable the extension soap