Ограничение памяти php nextcloud
Hello, i'm using the latest image (with nextcloud 14)
and when i run any php occ command. i get this message
The current PHP memory limit is below the recommended value of 512MB.
i haven't touch the image. it's the official image from docker hub vanilla (with clean installation to mariadb)
The text was updated successfully, but these errors were encountered:
Configuring Nextcloud
As an alternative to the upload_tmp_dir of PHP (e.g. if you don’t have access to your php.ini ) you can also configure a temporary location for uploaded files by using the tempdirectory setting in your config.php (See Configuration Parameters ).
If you have configured the session_lifetime setting in your config.php (See Configuration Parameters ) file then make sure it is not too low. This setting needs to be configured to at least the time (in seconds) that the longest upload will take. If unsure remove this completely from your configuration to reset it to the default shown in the config.sample.php .
xXZaretXx commented Sep 10, 2018
@bitdegree67 ups yes you are right , i'm blind
Configuring Nextcloud
As an alternative to the upload_tmp_dir of PHP (e.g. if you don’t have access to your php.ini ) you can also configure a temporary location for uploaded files by using the tempdirectory setting in your config.php (See Configuration Parameters ).
If you have configured the session_lifetime setting in your config.php (See Configuration Parameters ) file then make sure it is not too low. This setting needs to be configured to at least the time (in seconds) that the longest upload will take. If unsure remove this completely from your configuration to reset it to the default shown in the config.sample.php .
Configuring your Web server
Set the following two parameters inside the corresponding php.ini file (see the Loaded Configuration File section of PHP version and information to find your relevant php.ini files)
The upload_max_filesize and post_max_size settings may not apply to file uploads through WebDAV single file PUT requests or Chunked file uploads For those, PHP and webserver timeouts are the limiting factor on the upload size.
Adjust these values for your needs. If you see PHP timeouts in your logfiles, increase the timeout values, which are in seconds:
The mod_reqtimeout Apache module could also stop large uploads from completing. If you’re using this module and getting failed uploads of large files either disable it in your Apache config or raise the configured RequestReadTimeout timeouts.
There are also several other configuration options in your Web server config which could prevent the upload of larger files. Please see the manual of your Web server for how to configure those values correctly:
J0WI commented Sep 9, 2018
Large file upload on object storage
Chunked file uploads do have a larger space consumption on the temporary folder when processing those uploads on object storage as the individual chunks get downloaded from the storage and will be assembled to the actual file on the Nextcloud servers temporary directory. It is recommended to increase the size of your temp directory accordingly and also ensure that request timeouts are high enough for PHP, webservers or any load balancers involved.
The default maximum file size for uploads is 512MB. You can increase this limit up to what your filesystem and operating system allows. There are certain hard limits that cannot be exceeded:
64-bit filesystems have much higher limits; consult the documentation for your filesystem.
The Nextcloud sync client is not affected by these upload limits as it is uploading files in smaller chunks. See Client documentation for more information on configuration options.
Configuring PHP
If you are running Nextcloud on a 32-bit system, any open_basedir directive in your php.ini file needs to be commented out.
Set the following two parameters inside php.ini , using your own desired file size values:
Tell PHP which temp directory you want it to use:
bitdegree67 commented Sep 10, 2018
@xXZaretXx I myself proposed this solution
System configuration
Make sure that the latest version of PHP is installed
Disable user quotas, which makes them unlimited
Your temp file or partition has to be big enough to hold multiple parallel uploads from multiple users; e.g. if the max upload size is 10GB and the average number of users uploading at the same time is 100: temp space has to hold at least 10x100 GB
Apache
cynecx commented Sep 12, 2018 •
@bitdegree67 It is apparently still an issue with the php-fpm variant. My current solution is to have my own derived Dockerfile which simply increases the mem limit, but I think this should really be included in upstream (php-fpm and the alpine alt).
The default maximum file size for uploads is 512MB. You can increase this limit up to what your filesystem and operating system allows. There are certain hard limits that cannot be exceeded:
64-bit filesystems have much higher limits; consult the documentation for your filesystem.
The Nextcloud sync client is not affected by these upload limits as it is uploading files in smaller chunks. See Client documentation for more information on configuration options.
Configuring your Web server
Set the following two parameters inside the corresponding php.ini file (see the Loaded Configuration File section of PHP version and information to find your relevant php.ini files)
The upload_max_filesize and post_max_size settings may not apply to file uploads through WebDAV single file PUT requests or Chunked file uploads For those, PHP and webserver timeouts are the limiting factor on the upload size.
Adjust these values for your needs. If you see PHP timeouts in your logfiles, increase the timeout values, which are in seconds:
The mod_reqtimeout Apache module could also stop large uploads from completing. If you’re using this module and getting failed uploads of large files either disable it in your Apache config or raise the configured RequestReadTimeout timeouts.
There are also several other configuration options in your Web server config which could prevent the upload of larger files. Please see the manual of your Web server for how to configure those values correctly:
Apache with mod_fcgid
System configuration
Make sure that the latest version of PHP is installed
Disable user quotas, which makes them unlimited
Your temp file or partition has to be big enough to hold multiple parallel uploads from multiple users; e.g. if the max upload size is 10GB and the average number of users uploading at the same time is 100: temp space has to hold at least 10x100 GB
Apache with mod_fcgid
Configuring PHP
If you are running Nextcloud on a 32-bit system, any open_basedir directive in your php.ini file needs to be commented out.
Set the following two parameters inside php.ini , using your own desired file size values:
Tell PHP which temp directory you want it to use:
nginx
Since nginx 1.7.11 a new config option fastcgi_request_buffering is available. Setting this option to fastcgi_request_buffering off; in your nginx config might help with timeouts during the upload. Furthermore it helps if you’re running out of disc space on the tmp partition of your system.
Make sure that client_body_temp_path points to a partition with adequate space for your upload file size, and on the same partition as the upload_tmp_dir or tempdirectory (see below). For optimal performance, place these on a separate hard drive that is dedicated to swap and temp storage.
If your site is behind a nginx frontend (for example a loadbalancer):
By default, downloads will be limited to 1GB due to proxy_buffering and proxy_max_temp_file_size on the frontend.
If you can access the frontend’s configuration, disable proxy_buffering or increase proxy_max_temp_file_size from the default 1GB.
If you do not have access to the frontend, set the X-Accel-Buffering header to add_header X-Accel-Buffering no; on your backend server.
System configuration
Make sure that the latest version of PHP is installed
Disable user quotas, which makes them unlimited
Your temp file or partition has to be big enough to hold multiple parallel uploads from multiple users; e.g. if the max upload size is 10GB and the average number of users uploading at the same time is 100: temp space has to hold at least 10x100 GB
Apache
bitdegree67 commented Sep 11, 2018
Alright! so it's dsn't a problem for nextcloud, only for occ
ixinshang commented Sep 10, 2018
Hello,
i have the same problem ,someone who can slove it. thanks.
Adjust chunk size on Nextcloud side
For upload performance improvements in environments with high upload bandwidth, the server’s upload chunk size may be adjusted:
Put in a value in bytes (in this example, 20MB). Set --value 0 for no chunking at all.
Default is 10485760 (10 MB).
Large file upload on object storage
Chunked file uploads do have a larger space consumption on the temporary folder when processing those uploads on object storage as the individual chunks get downloaded from the storage and will be assembled to the actual file on the Nextcloud servers temporary directory. It is recommended to increase the size of your temp directory accordingly and also ensure that request timeouts are high enough for PHP, webservers or any load balancers involved.
The default maximum file size for uploads is 512MB. You can increase this limit up to what your filesystem and operating system allows. There are certain hard limits that cannot be exceeded:
64-bit filesystems have much higher limits; consult the documentation for your filesystem.
The Nextcloud sync client is not affected by these upload limits as it is uploading files in smaller chunks. See Client documentation for more information on configuration options.
J0WI commented Sep 10, 2018
J0WI commented Sep 11, 2018
Because it's the cli and not apache
nginx
Since nginx 1.7.11 a new config option fastcgi_request_buffering is available. Setting this option to fastcgi_request_buffering off; in your nginx config might help with timeouts during the upload. Furthermore it helps if you’re running out of disc space on the tmp partition of your system.
Make sure that client_body_temp_path points to a partition with adequate space for your upload file size, and on the same partition as the upload_tmp_dir or tempdirectory (see below). For optimal performance, place these on a separate hard drive that is dedicated to swap and temp storage.
If your site is behind a nginx frontend (for example a loadbalancer):
By default, downloads will be limited to 1GB due to proxy_buffering and proxy_max_temp_file_size on the frontend.
If you can access the frontend’s configuration, disable proxy_buffering or increase proxy_max_temp_file_size from the default 1GB.
If you do not have access to the frontend, set the X-Accel-Buffering header to add_header X-Accel-Buffering no; on your backend server.
bitdegree67 commented Sep 10, 2018
@J0WI No, as i said. i've just run
docker run nextcloud
and then in this new nextcloud run "php occ" then i get the message of warning 128MB
Adjust chunk size on Nextcloud side
For upload performance improvements in environments with high upload bandwidth, the server’s upload chunk size may be adjusted:
Put in a value in bytes (in this example, 20MB). Set --value 0 for no chunking at all.
Default is 10485760 (10 MiB).
nginx
Since nginx 1.7.11 a new config option fastcgi_request_buffering is available. Setting this option to fastcgi_request_buffering off; in your nginx config might help with timeouts during the upload. Furthermore it helps if you’re running out of disc space on the tmp partition of your system.
Make sure that client_body_temp_path points to a partition with adequate space for your upload file size, and on the same partition as the upload_tmp_dir or tempdirectory (see below). For optimal performance, place these on a separate hard drive that is dedicated to swap and temp storage.
If your site is behind a nginx frontend (for example a loadbalancer):
By default, downloads will be limited to 1GB due to proxy_buffering and proxy_max_temp_file_size on the frontend.
If you can access the frontend’s configuration, disable proxy_buffering or increase proxy_max_temp_file_size from the default 1GB.
If you do not have access to the frontend, set the X-Accel-Buffering header to add_header X-Accel-Buffering no; on your backend server.
xXZaretXx commented Sep 10, 2018
@bitdegree67
You can change it with
echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini;
inside the docker container
but i think its temporary and hacky
Configuring your Web server
Set the following two parameters inside the corresponding php.ini file (see the Loaded Configuration File section of PHP version and information to find your relevant php.ini files)
The upload_max_filesize and post_max_size settings may not apply to file uploads through WebDAV single file PUT requests or Chunked file uploads For those, PHP and webserver timeouts are the limiting factor on the upload size.
Adjust these values for your needs. If you see PHP timeouts in your logfiles, increase the timeout values, which are in seconds:
The mod_reqtimeout Apache module could also stop large uploads from completing. If you’re using this module and getting failed uploads of large files either disable it in your Apache config or raise the configured RequestReadTimeout timeouts.
There are also several other configuration options in your Web server config which could prevent the upload of larger files. Please see the manual of your Web server for how to configure those values correctly:
bitdegree67 commented Sep 11, 2018
The question is why .htaccess isn't used by "php occ"
Configuring Nextcloud
As an alternative to the upload_tmp_dir of PHP (e.g. if you don’t have access to your php.ini ) you can also configure a temporary location for uploaded files by using the tempdirectory setting in your config.php (See Configuration Parameters ).
If you have configured the session_lifetime setting in your config.php (See Configuration Parameters ) file then make sure it is not too low. This setting needs to be configured to at least the time (in seconds) that the longest upload will take. If unsure remove this completely from your configuration to reset it to the default shown in the config.sample.php .
Apache with mod_fcgid
xXZaretXx commented Sep 10, 2018
Hello,
i have the same problem ,
the php limit is to 128 (php -i | grep memory_limit)
the values in .htacess and user.ini are set to 512
Large file upload on object storage
Chunked file uploads do have a larger space consumption on the temporary folder when processing those uploads on object storage as the individual chunks get downloaded from the storage and will be assembled to the actual file on the Nextcloud servers temporary directory. It is recommended to increase the size of your temp directory accordingly and also ensure that request timeouts are high enough for PHP, webservers or any load balancers involved.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Open with Desktop
- View raw
- Copy raw contents Copy raw contents
Copy raw contents
Copy raw contents
Uploading big files > 512MB
The default maximum file size for uploads is 512MB. You can increase this limit up to what your filesystem and operating system allows. There are certain hard limits that cannot be exceeded:
64-bit filesystems have much higher limits; consult the documentation for your filesystem.
The Nextcloud sync client is not affected by these upload limits as it is uploading files in smaller chunks. See Client documentation for more information on configuration options.
- Make sure that the latest version of PHP is installed
- Disable user quotas, which makes them unlimited
- Your temp file or partition has to be big enough to hold multiple parallel uploads from multiple users; e.g. if the max upload size is 10GB and the average number of users uploading at the same time is 100: temp space has to hold at least 10x100 GB
Configuring your Web server
Set the following two parameters inside the corresponding php.ini file (see the Loaded Configuration File section of :ref:`label-phpinfo` to find your relevant php.ini files)
The upload_max_filesize and post_max_size settings may not apply to file uploads through WebDAV single file PUT requests or Chunked file uploads For those, PHP and webserver timeouts are the limiting factor on the upload size.
Adjust these values for your needs. If you see PHP timeouts in your logfiles, increase the timeout values, which are in seconds:
The mod_reqtimeout Apache module could also stop large uploads from completing. If you're using this module and getting failed uploads of large files either disable it in your Apache config or raise the configured RequestReadTimeout timeouts.
There are also several other configuration options in your Web server config which could prevent the upload of larger files. Please see the manual of your Web server for how to configure those values correctly:
Apache with mod_fcgid
Since nginx 1.7.11 a new config option fastcgi_request_buffering is available. Setting this option to fastcgi_request_buffering off; in your nginx config might help with timeouts during the upload. Furthermore it helps if you're running out of disc space on the tmp partition of your system.
Make sure that client_body_temp_path points to a partition with adequate space for your upload file size, and on the same partition as the upload_tmp_dir or tempdirectory (see below). For optimal performance, place these on a separate hard drive that is dedicated to swap and temp storage.
If your site is behind a nginx frontend (for example a loadbalancer):
By default, downloads will be limited to 1GB due to proxy_buffering and proxy_max_temp_file_size on the frontend.
- If you can access the frontend's configuration, disable proxy_buffering or increase proxy_max_temp_file_size from the default 1GB.
- If you do not have access to the frontend, set the X-Accel-Buffering header to add_header X-Accel-Buffering no; on your backend server.
If you are running Nextcloud on a 32-bit system, any open_basedir directive in your php.ini file needs to be commented out.
Set the following two parameters inside php.ini , using your own desired file size values:
Tell PHP which temp directory you want it to use:
As an alternative to the upload_tmp_dir of PHP (e.g. if you don't have access to your php.ini ) you can also configure a temporary location for uploaded files by using the tempdirectory setting in your config.php (See :doc:`../configuration_server/config_sample_php_parameters` ).
If you have configured the session_lifetime setting in your config.php (See :doc:`../configuration_server/config_sample_php_parameters` ) file then make sure it is not too low. This setting needs to be configured to at least the time (in seconds) that the longest upload will take. If unsure remove this completely from your configuration to reset it to the default shown in the config.sample.php .
Adjust chunk size on Nextcloud side
For upload performance improvements in environments with high upload bandwidth, the server's upload chunk size may be adjusted:
Put in a value in bytes (in this example, 20MB). Set --value 0 for no chunking at all.
Default is 10485760 (10 MiB).
Large file upload on object storage
Chunked file uploads do have a larger space consumption on the temporary folder when processing those uploads on object storage as the individual chunks get downloaded from the storage and will be assembled to the actual file on the Nextcloud servers temporary directory. It is recommended to increase the size of your temp directory accordingly and also ensure that request timeouts are high enough for PHP, webservers or any load balancers involved.
Configuring PHP
If you are running Nextcloud on a 32-bit system, any open_basedir directive in your php.ini file needs to be commented out.
Set the following two parameters inside php.ini , using your own desired file size values:
Tell PHP which temp directory you want it to use:
Apache
Adjust chunk size on Nextcloud side
For upload performance improvements in environments with high upload bandwidth, the server’s upload chunk size may be adjusted:
Put in a value in bytes (in this example, 20MB). Set --value 0 for no chunking at all.
Default is 10485760 (10 MiB).
J0WI commented Sep 9, 2018
Читайте также: