Cannot upload large files

I am running Nextcloud in the following environment

PRETTY_NAME=“Ubuntu 22.04.3 LTS”
nginx/1.25.3
PHP 8.2.13 (cli) (built: Nov 24 2023 08:47:18) (NTS)
mariadb Ver 15.1 Distrib 10.6.12-MariaDB
(I don’t use docker.)

The upload itself seems to work fine, but when I try to upload a large file, I get an “estimating time left” message and the upload never finishes.

So, I added the following description.

[/etc/php/8.2/fpm/php.ini].

max_execution_time 21600
request_terminate_timeout 0
client_max_body_size 15G
max_input_time = -1
memory_limit = 1024M
post_max_size = 15G
upload_max_filesize = 15G

[/etc/nginx/site-available/example.com.conf].

fastcgi_read_timeout 7200;
fastcgi_send_timeout 7200;
fastcgi_connect_timeout 7200;
proxy_read_timeout 7200;
proxy_send_timeout 7200;
proxy_connect_timeout 7200;
send_timeout 7200;
client_max_body_size 15G;
client_body_timeout 600s;
fastcgi_buffers 64 4K;
client_body_buffer_size 512k;

If you look at the system in the left pane under administration, you will see the maximum upload size: 4.9 GB in PHP.

In reality, however, it is not even possible to upload a 10 MB file.

What could be the cause?

Thanks!

  • What are you uploading from? The web UI? Desktop client? One of the mobile clients? Curl? etc?
  • What do your Nextcloud logs indicate?
  • Also might be worth checking your browser console’s Network tab

upload_max_filesize = 15G
[…]
If you look at the system in the left pane under administration, you will see the maximum upload size: 4.9 GB in PHP.

Then your PHP configuration is not active because that merely outputs the currently active (in-service) value of upload_max_filesize. I suggest:

  • restart FPM
  • confirm you don’t have other versions of PHP installed/active (the 8.2.13 you referenced appears to come from your PHP CLI installation not necessarily your PHP FPM installation) [e.g. are there other versions in /etc/php?]

I am trying to upload from the Web UI. (It’s Chrome on my PC.)
I have looked at the Log and it does not show any errors or warnings at the time I am trying to upload the file.
I’m sorry, but where do I look in the browser console’s Network tab?

I have done restart FPM.
I checked and found only 8.2 under /etc/php/.

/etc/php/8.2/cli/php.ini existed.
So, I wrote at the top of the file

client_max_body_size 15G
request_terminate_timeout 0

but this does not change the situation.
Do you need any other information?

Thanks!!

Where did you install PHP from? PHP 8.2.13 isn’t available in Ubuntu 22.04.3.

If you’re not using the standard Ubuntu PHP, your config may be located elsewhere.

You might find some hints by running php --ini (if your CLI PHP install is the counterpart of your FPM PHP install).

I installed PHP using the following steps

1.sudo add-apt-repository ppa:ondrej/php
2. sudo apt update
3. sudo apt install php8.2 -y

The result of php --ini is as follows

Configuration File (php.ini) Path: /etc/php/8.2/cli
Loaded Configuration File:         /etc/php/8.2/cli/php.ini
Scan for additional .ini files in: /etc/php/8.2/cli/conf.d
Additional .ini files parsed:      /etc/php/8.2/cli/conf.d/10-mysqlnd.ini,
/etc/php/8.2/cli/conf.d/10-opcache.ini,
/etc/php/8.2/cli/conf.d/10-pdo.ini,
/etc/php/8.2/cli/conf.d/15-xml.ini,
/etc/php/8.2/cli/conf.d/20-apcu.ini,
/etc/php/8.2/cli/conf.d/20-bcmath.ini,
/etc/php/8.2/cli/conf.d/20-calendar.ini,
/etc/php/8.2/cli/conf.d/20-ctype.ini,
/etc/php/8.2/cli/conf.d/20-curl.ini,
/etc/php/8.2/cli/conf.d/20-dom.ini,
/etc/php/8.2/cli/conf.d/20-exif.ini,
/etc/php/8.2/cli/conf.d/20-ffi.ini,
/etc/php/8.2/cli/conf.d/20-fileinfo.ini,
/etc/php/8.2/cli/conf.d/20-ftp.ini,
/etc/php/8.2/cli/conf.d/20-gd.ini,
/etc/php/8.2/cli/conf.d/20-gettext.ini,
/etc/php/8.2/cli/conf.d/20-gmp.ini,
/etc/php/8.2/cli/conf.d/20-iconv.ini,
/etc/php/8.2/cli/conf.d/20-imagick.ini,
/etc/php/8.2/cli/conf.d/20-intl.ini,
/etc/php/8.2/cli/conf.d/20-mbstring.ini,
/etc/php/8.2/cli/conf.d/20-mysqli.ini,
/etc/php/8.2/cli/conf.d/20-pdo_mysql.ini,
/etc/php/8.2/cli/conf.d/20-phar.ini,
/etc/php/8.2/cli/conf.d/20-posix.ini,
/etc/php/8.2/cli/conf.d/20-readline.ini,
/etc/php/8.2/cli/conf.d/20-shmop.ini,
/etc/php/8.2/cli/conf.d/20-simplexml.ini,
/etc/php/8.2/cli/conf.d/20-sockets.ini,
/etc/php/8.2/cli/conf.d/20-sysvmsg.ini,
/etc/php/8.2/cli/conf.d/20-sysvsem.ini,
/etc/php/8.2/cli/conf.d/20-sysvshm.ini,
/etc/php/8.2/cli/conf.d/20-tokenizer.ini,
/etc/php/8.2/cli/conf.d/20-xmlreader.ini,
/etc/php/8.2/cli/conf.d/20-xmlwriter.ini,
/etc/php/8.2/cli/conf.d/20-xsl.ini,
/etc/php/8.2/cli/conf.d/20-zip.ini

So looking at the results, it appears that the configuration file

/etc/php/8.2/cli/php.ini

appears to be used.

However, that file contains a

client_max_body_size of 15G
request_terminate_timeout 0

and it says

Is there something wrong with the way the parameters are written?

Thanks!!

I took the plunge and reinstalled ubuntu itself from scratch.
This time, I kept Ubuntu, Nginx and MariaDB the same, and changed only PHP to 8.1.
The configuration is the same as PHP8.2.
Then I was able to upload large files this time.
There may be other factors, but this is just a report for now.
Thanks.

Sorry, a bit late and it may not be relevant anymore as this seems to be solved.

You edited the wrong file:

cli is PHPs’ command line interpreter which is only used on the command line. For what happens in the browser, you need to edit the fpm ini file from PHP. In your case (with PHP 8.1) you should find it under /etc/php/8.1/fpm/php.ini.

1 Like