Answer a question

I am using laravel + twill inside docker containers with php7.4.3-fpm + nginx. Everything works fine appart from when I am trying to upload images of high resolution. If I upload image of 3000x3000px there are no problem as soon as I try to do the same with higher resolution (4500x4500px) I get the following error,

message: "stream_copy_to_stream(): read of 8192 bytes failed with errno=21 Is a directory"
exception: "ErrorException"
file: "/var/www/backend/vendor/league/flysystem/src/Adapter/Local.php"
line: 159
trace: [{function: "handleError", class: "Illuminate\Foundation\Bootstrap\HandleExceptions", type: "->"},…]
0: {function: "handleError", class: "Illuminate\Foundation\Bootstrap\HandleExceptions", type: "->"}
function: "handleError"
class: "Illuminate\Foundation\Bootstrap\HandleExceptions"
type: "->"
1: {file: "/var/www/backend/vendor/league/flysystem/src/Adapter/Local.php", line: 159,…}
file: "/var/www/backend/vendor/league/flysystem/src/Adapter/Local.php"
line: 159
function: "stream_copy_to_stream"

Is it a php-fpm configuration issue? Is it problem with php? Has anyone had similar problems?

Answers

I did find a solution, my problem was with php.ini setting, how lame of me to overlook it. I fixed it by adding these to the docker entry file.

sed -i -e "s/upload_max_filesize = 2M/upload_max_filesize = 64M/g" $PHP_INI_DIR/php.ini
sed -i -e "s/post_max_size = 8M/post_max_size = 64M/g" $PHP_INI_DIR/php.ini
sed -i -e "s/memory_limit = 128M/memory_limit = 256M/g" $PHP_INI_DIR/php.ini
Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐