Sting's avatar
Level 1

upload large file in php not working

I am trying to upload large file on my web application, I edited the max_file_uploads and post_max_size in my php.ini file which is located in /etc/php/7.4/fpm/php.ini, and edited ngnix.conf and added http { client_max_body_size 100M; } and restarted php7.4-fpm and ngnix but still I get 413 error code and can't upload large files

0 likes
8 replies
Sinnbeck's avatar

How big is the file? What error are you getting in your nginx logs ? /var/log/nginx.log most likely

Sting's avatar
Level 1

@Sinnbeck okay here is the error.log, 2023/01/26 11:58:30 [error] 9003#9003: *2366 client intended to send too large body: 20972887 bytes, client: 127.0.0.1, server: *.project.test, request: "POST /sites/upload-construction-layers/71?resumableC>

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@Sting So it isnt being picked up somewhere. Start by creating a file named info.php inside your public folder.

<?php
phpinfo();

Addt this content and open it in a browser. Find max_file_uploads and post_max_size and ensure they have the correct values

Sting's avatar
Level 1

2023/01/26 13:03:17 [error] 255966#255966: *8 FastCGI sent in stderr: "PHP message: PHP Warning: POST Content-Length of 20972887 bytes exceeds the limit of 8388608 bytes in Unknown on line 0" while reading res>

Sting's avatar
Level 1

@Sinnbeck, It's fixed now, the issue was that the new values were not read by php or nginx, so I made sure to restart both and now everything works fine.

Thank you,

Please or to participate in this conversation.