Большие файлы не загружаются на рабочий php сервер - PullRequest
0 голосов
/ 05 августа 2020

Вот мои значения php .ini в производстве.

Apache версия 2.4.39 Php версия 5.6 Aws частный сегмент s3

Php.ini

post_max_size = 2G
upload_max_filesize = 1G
memory_limit = -1
max_execution_time = 20000
max_input_time = 60000
max_file_uploads = 200

Мы пытается загрузить файлы размером 25 МБ, но не загружает и не возвращает никаких ошибок.

Вот мой код

public function upload(Request $request)
    {       
        $input = $request->input();
        if ($request->hasFile('file')) {

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

            $image_name_underscore = $image->getClientOriginalName();
            $image_name = str_replace(" ", "_", $image_name_underscore);
            $image_name = preg_replace('/[^A-Za-z0-9\-.]/', '', $image_name);
            $file_ext = $image->getClientOriginalExtension();
            if($file_ext == "")
            {
                $file_ext = 'png';
            }
            $image_name_new = $input["attachment_nonce"].".".$file_ext;
            $file_ext = strtolower($file_ext);
            if($file_ext == "jpeg" || $file_ext == "jpg" || $file_ext == "png" || $file_ext == "gif")
            {
                $directory = "/assets/".getSubdomainName()."/chat_images/".$input['chat_id'];
                $destinationPath = public_path($directory);
               $filename = $image_name_new;

            $s3 = \Storage::disk('s3');
                $filePath = getSubdomainName().'/chat-images/'. $input['chat_id'] .'/'. $filename;

                if($this->detect->isMobile() || $this->detect->isTablet())
                {
                    $img = Image::make($image);
                    $img->resize(600, null, function ($constraint) {
                       $constraint->aspectRatio();
                    });
                    $image_normal = $img->orientate();
                } else
                {
                    $image_normal = Image::make($image)->orientate();
                }

                $image_normal = $image_normal->stream();

                $res = $s3->put($filePath, $image_normal->__toString());
                $imgPath = $s3->url($filePath);
                 $image_normal->__destruct();
                unset($image_normal);
                return response()->json(array('status' => 200, 'filename' => $image_name_underscore, 'file' => $imgPath));

           }
       }

Если изображение больше 20 МБ, то код не выполняется после 1-й строки. Т.е. после $ request-> input () ничего не выполняется. Это происходит только на рабочем сервере. При печати значения Php .ini правильно отображаются в коде. Дайте мне знать, в чем будет проблема?

...