Laravel-medialibrary: HTTP 500 error when uploading (large) file

Created on 7 Sep 2016  路  7Comments  路  Source: spatie/laravel-medialibrary

Hi, I'm trying to use a media conversion to resize the uploaded images.

When I upload small files (around 300kB), everything works. The images are stored correctly and a conversion shows up in the media public folder. However when I try to upload a 5MB image, I get a http 500 error.

ProjectController.php:
$project->addMedia($request->file('cover_image'))->toCollection('cover_images');

Project.php:
public function registerMediaConversions() { $this->addMediaConversion('cover_image') ->setManipulations(['w' => 1920, 'h' => 1080]) ->performOnCollections('cover_images'); }

And this is in my server config:
nginx:
client_max_body_size 200M;

php:
upload_max_filesize = 200M post_max_size = 220M

If I comment out the media conversion and try to upload the 5MB file, everything works as normal.

Thanks in advance

Most helpful comment

Also there can be several php.ini files (like differents one for running php in the cli and under nginx)

You can use the locate command to find them on linux:

$ locate php.ini

/etc/php/7.0/cli/php.ini
/etc/php/7.0/fpm/php.ini

All 7 comments

Yes I have.
'max_file_size' => 1024 * 1024 * 100,

Have you increased the default values for upload_max_filesize and post_max_size in your php.ini?

Also there can be several php.ini files (like differents one for running php in the cli and under nginx)

You can use the locate command to find them on linux:

$ locate php.ini

/etc/php/7.0/cli/php.ini
/etc/php/7.0/fpm/php.ini

Or use php --ini 馃槃

This is a screenshot of what my phpinfo() outputs. These values should be sufficient?
image

Solved it, I had to increase this in my php.ini to something bigger.
memory_limit=128M

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ideadx picture ideadx  路  4Comments

brendt picture brendt  路  4Comments

aaronfullerton picture aaronfullerton  路  4Comments

Nks picture Nks  路  3Comments

drtheuns picture drtheuns  路  3Comments