Memory settings for PHP for large file sizes (videos for example)

Does anyone have tips or experience with large photo sets (say 4 TB) inside NextCloud?

Also how is performance when users view large video files (1-2 GB size)?

If RAM were unlimited on your system, and you had large files to save and serve, what would you allocate to PHP?

copy & paste from php.net:

memory_limit int

This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1.

When an int is used, the value is measured in bytes. Shorthand notation, as described in this FAQ, may also be used.

memory_limit = -1

upload_max_filesize int
The maximum size of an uploaded file.
post_max_size must be larger than this value.

post_max_size int
Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be larger than post_max_size. When an int is used, the value is measured in bytes. Shorthand notation, as described in this FAQ, may also be used. If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. This can be tracked in various ways, e.g. by passing the $_GET variable to the script processing the data, i.e. <form action="edit.php?processed=1">, and then checking if $_GET[‘processed’] is set.
Its value may be 0 to disable the limit.

post_max_size = 0
upload_max_filesize = 64G

Much luck,
ernolf

1 Like

Thank you. I am considering setting these specific to NextCloud by editing the .user.ini file.

There is normally nothing wrong with that but that way it is not persistent. So you have to set it after every update.

Much luck,
ernolf

OH! Thank you for letting me know!

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.