【发布时间】:2012-10-02 01:50:04
【问题描述】:
我正在尝试结合 Symfony2、KnpGaufetteBundle 和 Amazon S3。 从 KnpGaufette Bundle 我得到了一个用于我的配置的 xml 定义。但它在 xml 中,我的配置在 yml 中。不知何故,我无法理解它。如何在 yml 中定义以下变量?它们是什么意思?
<service id="acme.s3" class="AmazonS3">
<argument type="collection">
<argument key="key">%acme.aws_key%</argument>
<argument key="secret">%acme.aws_secret_key%</argument>
</argument>
</service>
<service id="acme.s3.adapter" class="Gaufrette\Adapter\AmazonS3">
<argument type="service" id="acme.s3"></argument>
<argument>%acme.s3.bucket_name%</argument>
</service>
<service id="acme.fs" class="Gaufrette\Filesystem">
<argument type="service" id="acme.s3.adapter"></argument>
</service>
更新完整的解决方案
所以,要真正让它工作,我们不仅需要将配置放在 yml 中(这已由 chmeliuk -> 谢谢),而且我们还需要为 curl 配置 cacert.pem 文件。 你可以在这里得到一个合适的:http://curl.haxx.se/ca/cacert.pem
现在把它放在任何你想要的地方,然后使用下面的行加上额外的 certificate_authority 条目:
services:
acme.s3:
class: AmazonS3
arguments:
options: { key: %acme.aws_key%, secret: %acme.aws_secret_key%, certificate_authority: "pathWhereYouDidPutThisFile/cacert.pem" }
acme.s3.adapter:
class: Gaufrette\Adapter\AmazonS3
arguments:
service: @acme.s3
bucket_name: %acme.s3.bucket_name%
acme.fs:
class: Gaufrette\Filesystem
arguments:
adapter: @acme.s3.adapter
这解决了您可能遇到的 CA Cert cURL 错误 60。
【问题讨论】:
标签: php curl symfony configuration amazon-s3