2016-06-25 30 views
0

私はdropzoneにLaravelとS3を設定しています。小さなファイルの場合はスムーズに動作します。私はアップロードされたファイルを見ることができます。私は同じアプローチが、何を使用して、2.5メガバイトのファイルをアップロードしようとしていますLaravel、Dropzone、S3

は、私はいつも

`Network Error (tcp_error) 

A communication error occurred: "Can't send more" The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time. 

For assistance, contact your network support team.` 

を得る作品私はupload sizemax_post_sizeを高めるためにPHPの設定を変更し、まだ何も何ができるか

を働いていません問題?

$video = $request->file('file'); 
    if($video !==null) { 
     $s3 = Storage::disk('s3'); 
     $stamp = Carbon::now(); 
     $email = $request->header('email'); 
     $videoFileName = $email . $stamp->toDateTimeString() . '.' . $video->getClientOriginalExtension(); 
     $filePath = 'videos/' . $videoFileName; 
     $s3->put($filePath, fopen($video, 'r+'), 'public'); 
     Mail::queue('emails.videoUploaded', ['email' => $email], function ($message) use($email) { 
      $message->from('[email protected]', 'Mohammad Abu Musa'); 
      $message->to($email); 
      $message->subject('Video Uploaded - FindEarlyAdopters.com'); 
     }); 

     Mail::queue('emails.uploadedVideoNotification', ['email' => $email , 'videoLocation'=>$s3->url($filePath)], function ($message) use ($email) { 
      $message->from('[email protected]', 'Mohammad Abu Musa'); 
      $message->to("[email protected]"); 
      $message->subject('New Video Uploaded - FindEarlyAdopters.com'); 
     }); 

     return Response::json(array(
      'success' => true, 
     )); 
    } 

DropZone.jsコード下のコントローラで

コードが

$("#videoUploader").dropzone({ 
     url: "{{route('postTestVideo')}}", 
     headers: { 
      'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content'), 
      'email':getParameterByName('email') 
     }, 
     init: function() { 
      this.on("success", function(file, response) { 
       if(response.success == true) 
        window.location="{{route('yourTests',array('thank-you'=>true))}}"; 
       else 
        $('#error').show(); 
      }) 
     } 
    }); 

を下回っている私はここにコードを展開するdokku使用しています私は今

設定に持っているものです

web: vendor/bin/heroku-php-apache2 -C httpd.inc.conf -i php.ini public/

httpd.inc.conf

`Timeout 30 
KeepAlive On 
MaxKeepAliveRequests 50 
KeepAliveTimeout 10 

<IfModule prefork.c> 
    StartServers   3 
    MinSpareServers  2 
    MaxSpareServers  5 
    MaxClients   10 
    MaxRequestsPerChild 1000 
</IfModule> 

、これは私がphp.iniで持っているものである

memory_limit = 512M 
post_max_size = 150M 
upload_max_filesize = 100M 
max_execution_time = 86400 
max_file_uploads = 40 
+0

http://stackoverflow.com/questions/22125245/network-error-tcp-error-a-communication-エラーが発生しました – manshu

+0

http://imperialwicket.com/tuning-apache-for-a-low-memory-server-like-aws-micro-ec2-instances/ – manshu

+0

この記事を読んで、問題を解決できると思った残念ながら –

答えて

0
/etc/httpd/conf/httpd.conf 

Timeout 30 
KeepAlive On 
MaxKeepAliveRequests 50 
KeepAliveTimeout 10 

<IfModule prefork.c> 
    StartServers   3 
    MinSpareServers  2 
    MaxSpareServers  5 
    MaxClients   10 
    MaxRequestsPerChild 1000 
</IfModule> 

# if you are using workers, update the IfModule worker.c section similarly. 
/etc/php.ini 

memory_limit = 100M 
+0

あなたはそれらを試してみましたか?私はこれらのコマンドが何をするか分からない –

+0

あなたの端末でこれらを実行すると、彼らはあなたのメモリのブロックサイズを変更します – manshu

+0

私はちょうどやっていませんでした –