谁能帮我找出如何让S3工作在我的PHP应用程序引擎(运行:php55 )?
Could anyone help me figure out how to get S3 working on my php app engine (runtime: php55)?
我看到的地方,你可以使用它没有卷曲,发现StreamWrapper但要得到错误。
I saw somewhere that you can use it without CURL and found the StreamWrapper but keep getting errors.
Use of undefined constant CURLE_COULDNT_RESOLVE_HOST Use of undefined constant CURLE_COULDNT_CONNECT Use of undefined constant CURLE_PARTIAL_FILE etc..下面是我的code:
use Aws\S3\S3Client; use Aws\S3\Exception\S3Exception; // Instantiate an S3 client $s3 = S3Client::factory(array('key' => 'KEY','secret' => 'SECRET')); $s3->registerStreamWrapper(); // don't use curl //AMAZON S3 BACKUP// $document_data = "123456"; $s3_object_url = "s3://bucket/folder/file.txt"; $s3_options = stream_context_create(['s3'=>['ACL'=>'bucket-owner-full-control', 'ServerSideEncryption' => 'AES256']]); $s3_file = fopen($s3_object_url, 'w', false, $s3_options); fwrite($s3_file, $document_data); fclose($s3_file);
错误使用curl精简版时:
Error when using curl lite:
PHP Fatal error: Uncaught exception 'google\appengine\runtime\CurlLiteMethodNotSupportedException' with message 'curl_multi_init' in /base/data/home/runtimes/php/sdk/google/appengine/runtime/CurlLiteStub.php:1391 Stack trace: #0 /base/data/home/apps/.../vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php(50): curl_multi_init() #1 /base/data/home/apps/.../vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMultiProxy.php(128): Guzzle\Http\Curl\CurlMulti->__construct(1) #2 /base/data/home/apps/.../vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMultiProxy.php(87): Guzzle\Http\Curl\CurlMultiProxy->getAvailableHandle() #3 /base/data/home/apps/.../vendor/guzzle/guzzle/src/Guzzle/Http/Client.php(284): Guzzle\Http\Curl\CurlMultiProxy->send() #4 /base/data/home/apps/.../vendor/aws/aws-sdk-php/src/Aws/Common/Client/AbstractClient.php(256): Guzzle\Http\Client->send(Ob in /base/data/home/runtimes/php/sdk/google/appengine/runtime/CurlLiteStub.php on line 1391在使用扩展=curl.so在php.ini
Error when using extension = "curl.so" in php.ini
15:09:52.614遇到问题与处理该请求,引起它退出该过程。这很可能导致要用于下一个请求将应用程序的新工艺。 (错误code 204)
15:09:52.614 A problem was encountered with the process that handled this request, causing it to exit. This is likely to cause a new process to be used for the next request to your application. (Error code 204)
它看起来像狂饮需要卷曲启用,所以我启用扩展=curl.so在我的php.ini并能正常工作在我的本地开发者与无错误。但不是当我把它上传到应用程序引擎。
It looks like "guzzle" needs curl enabled so I enabled extension = "curl.so" in my php.ini and it works fine in my localhost developer with no errors. But not when I upload it to app engine.
推荐答案尽管GAE支持卷曲 - 这只是一个包装,因此有些功能尚未实现,但 - 尤其是整个 multi_curl_ * 的事情。
Even though GAE supports "cURL" - it is only a wrapper, so some functionality has not been implemented yet - particularly the whole multi_curl_* thing.
还没有找到一种方法来禁用它 - 但是从SDK V3卷曲,不再被需要 - 所以你可能给一个尝试
Have not found a way to deactivate it - but from SDK v3 cURL is not anymore required - so you might give that a try.
更多推荐
亚马逊S3 PHP的GAE不工作,卷曲扩展
发布评论