【问题标题】:Use of undefined constant CURLOPT_PROTOCOLS error when using Laravel and S3使用 Laravel 和 S3 时使用未定义常量 CURLOPT_PROTOCOLS 错误
【发布时间】:2015-08-26 00:20:40
【问题描述】:

我只是在使用 S3 时遇到了 Laravel 5.1 中的 Storage 门面。

我在控制器中有以下代码:

    $file = $request->file('file');

    $extension = $file->getClientOriginalExtension();

    $filename = date('d-m-Y').'_'.$request->get('author').'.'.$extension;
    Storage::put($filename, $file);

但是我收到以下错误:

S3Exception in WrappedHttpHandler.php line 162: Error executing "HeadObject" on "https://s3-eu-west-1.amazonaws.com/[REDACTED]/10-06-2015_my%20file.jpg"; AWS HTTP error: Use of undefined constant CURLOPT_PROTOCOLS - assumed 'CURLOPT_PROTOCOLS'

我在 Ubuntu 14.04 上安装了 cURL 和 php5-curl。我正在使用 HHVM 3.7。

【问题讨论】:

标签: php laravel curl amazon-web-services amazon-s3


【解决方案1】:

最初没有注意到您正在使用 hhvm。不支持。

【讨论】:

    【解决方案2】:

    正如 John 所说,hhvm 3.7 (stable) 不支持 curl setopt。我升级到夜间构建(3.8.0-dev)并且它工作!然而,对于生产环境可能不是一个好的解决方案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-31
      • 1970-01-01
      相关资源
      最近更新 更多