Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP GAE上的AmazonS3不能使用curl扩展_Php_Google App Engine_Amazon S3 - Fatal编程技术网

PHP GAE上的AmazonS3不能使用curl扩展

PHP GAE上的AmazonS3不能使用curl扩展,php,google-app-engine,amazon-s3,Php,Google App Engine,Amazon S3,谁能帮我弄清楚如何让S3在我的php应用程序引擎上工作(运行时:php55) 我在某个地方看到,您可以不使用CURL就使用它,并找到了StreamWrapper,但不断出现错误 Use of undefined constant CURLE_COULDNT_RESOLVE_HOST Use of undefined constant CURLE_COULDNT_CONNECT Use of undefined constant CURLE_PARTIAL_FILE etc.. 这是我的密码:

谁能帮我弄清楚如何让S3在我的php应用程序引擎上工作(
运行时:php55

我在某个地方看到,您可以不使用CURL就使用它,并找到了StreamWrapper,但不断出现错误

Use of undefined constant CURLE_COULDNT_RESOLVE_HOST
Use of undefined constant CURLE_COULDNT_CONNECT
Use of undefined constant CURLE_PARTIAL_FILE
etc..
这是我的密码:

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 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
在php.ini中使用
extension=“curl.so”
时出错

15:09:52.614处理此请求的进程遇到问题,导致其退出。这可能会导致应用程序的下一个请求使用新进程。(错误代码204)

编辑:
看起来“guzzle”需要启用curl,所以我在php.ini中启用了
extension=“curl.so”
,并且在本地主机开发人员中运行良好,没有任何错误。但当我将其上载到应用程序引擎时,情况就不一样了。

curl需要套接字,这些套接字仅可用于启用账单的应用程序()。您可能还希望考虑“卷曲Lite”:

尽管GAE支持“卷曲”-它只是一个包装器,但一些功能尚未实现——特别是整个<代码>多个CURL**<代码> >


还没有找到停用它的方法-但是从SDK v3开始不再需要cURL-所以您可以尝试一下。

我已经尝试了“cURL-lite”和启用cURL。我应该提到的是,我正在使用一个支持账单的应用程序。我需要启用“套接字”还是应该已经启用?除非它像一个开关,否则我看不出上面的代码会受到什么影响。请注意编辑,我说它在Dev服务器上工作,但在部署上不工作。如果启用curl_-lite,您会看到什么错误?这些常量是明确定义的。@StuartLangley我编辑了我的问题,以显示使用AWS SDK for PHP的curl_liteV3时出现的错误,它不需要curl。它还在测试阶段。你能不能也显示使用curl的错误?@Mars将它添加到了问题中,你对错误的含义有什么建议或指导吗?