How to increase max_upload_size on apache server - php

In my application, I want to upload a file more than 500 MB, but it's giving me an error as the file is too big to upload.
I tried different ways to increase max_upload_size in php.ini and through .htacccess
but its increased till 128MB not more than that.
is there any way to increase it more than 500MB
Thanks in advance

To upload large files, post_max_size value must be larger than upload_max_filesize.
memory_limit should be larger than post_max_size
memory_limit > post_max_size > upload_max_filesize
PHP Default: 128M > 8M > 2M
So you can try to increase memory_limit as well if you've increased post_max_size and upload_max_filesize

I had the same issue before
I tried this plugin to increase it
https://wordpress.org/plugins/upload-max-file-size/
and
if it's not working you can edit in the htaccess file in WordPress directory and edit the file replacing xx with your preferred value
php_value upload_max_filesize xxM

Related

PHP ERR_CONNECTION_RESET error with FILE UPLOAD more than 8MBs

My server settings are as below:
max_execution_time : 0
max_input_time : -1
memory_limit : 128M
upload_max_filesize : 128M
post_max_size : 128M
still I am getting ERR_CONNECTION_RESET while uploading a file (size > 8MBs). Not even var_dump($_FILES); is working. Any file size below 8MBs is uploading easily. Not sure where I am wrong. Please suggest.
Although all the server configurations are set still I am getting the same issue.
Check your php settings for both of these:
upload_max_filesize = 64M
post_max_size = 64M
The problem in my case is the file I was trying to upload.
That PDF file was corrupted. I repaired the PDF file with some online PDF file repairing tool and it worked fine.
In case if you have shared server, you can add php.ini file and add following lines to it.
memory_limit = 1024M
max_input_vars = 2000
upload_max_filesize = 300M
post_max_size = 300M
max_execution_time = 990
This will work fine.
In additional to the above, make sure that
LimitRequestBody
in your .htaccess file is set properly or disabled altogether. 0 means unlimited
Docs here
Apache LimitRequestBody Directive

Increase max file upload size for SilverStripe site

I am working on increasing the max upload file size for a SilverStripe site as I want the new limit to be 20 MB instead of 2 MB. I have placed this line of code in the root .htaccess file for the project:
php_value upload_max_filesize 20M
This works to some extent. It has increased the upload size limit, but only to 8 MB. I removed this line of code and tried uploading a large file again and the "file size exceeds 2 MB" error returned. So, what I have in place does work but only increases the file size limit to 8 MB.
I have been reading that there can be a php.ini file included in the project to increase the file size limit as well, but I am wondering if there is a way to do it through just the .htaccess file?
The reason for this problem is because you've not set your post_max_size. The post_max_size defaults to 8mb. So you need to do the following:
php_value upload_max_filesize 20M
php_value post_max_size 50M
You can obviously edit the post_max_size to something more suitable to what you need.
This 100% work in v4
Your problem is indeed related to php.ini.
In php.ini there is a section related to file uploads that will have the following line in it;
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
Change the 2M to be something more in line with what you need, then restart apache and you should be good to go.
It is also possible (though i have not tried this yet) to put the following line in to the .htaccess.
php_value upload_max_filesize 20M
Hope that helps.

php upload maximum size file using php.ini file and .htaccess

upgrade upload_max_filesize
currently show 2M
i Want To 50M
php.ini code
upload_max_filesize=30M;
.htaccess file code
php_value upload_max_filesize 30M
but these file is not work
if i upload .htaccess file then show 500 server error .
please sol this problem thanks .
PHP has several configuration options to limit resources consumed by scripts. By default, PHP is set to allow uploads of files with a size of 2MB or less.
Try increasing the following values in php.ini, for example:
memory_limit = 32M
upload_max_filesize = 32M
post_max_size = 32M
If you want to set those values only for specific project then do it in .htaccess file otherwise set values in php.ini file
.htaccess file should be:-
php_value post_max_size 32M
php_value upload_max_filesize 32M
set the value of upload_max_filesize and post_max_size in your php.ini:
Maximum allowed size for uploaded files.
upload_max_filesize = 50M
Must be greater than or equal to upload_max_filesize
post_max_size = 50M

PHP - can't upload files bigger than 20MB

I have a problem with adding multiple files on my server. Everything works fine on smaller files (<20MB). They are uploading on the server and into my data base without any errors or problems. But when I want to add files bigger than 20MB (for example 10 files, 2,2MB each) uploading doesn't work. There is no error, just nothing is sended via _POST. I tried to change php.ini files, but it is still the same problem.
I've increased:
max_execution_time to one hour
max_file_uploads to 100 files
memory_limit to 512M
output_buffering to 30M (earlier I've turned it off)
post_max_size to 64MB
upload_max_filesize to 64M
The website is on OVH hosting, so every changes I've made in .user.ini file. When I'm trying phpinfo() it shows values which I've changed.
Anyone knows any solution?
in your .htaccess file, this allow me to add upto 2 GB
php_value upload_max_filesize 2048M
php_value post_max_size 2048M
php_value max_execution_time 259200

Config php ini file for upload files

I have a page for upload files, In .htaccess file I have this:
php_value upload_max_filesize 40M
php_value post_max_size 40M
I have an img, with size 1.6 MB. When I am trying to upload this image, I obtain the error below.
Fatal error: Allowed memory size of 54525952 bytes exhausted (tried to allocate 3600 bytes) in....
Does anyone know how to solve this problem?
if you can cant access php.ini on server then write below in your .htaccess file
php_value upload_max_filesize 10M
php_value post_max_size 20M
php_value memory_limit 32M
You need to set following values to increase file upload size
file_uploadsile_uploads
upload_max_filesize
max_input_time
memory_limit
max_execution_time
post_max_size
Cheers
As far as I can tell, you're probably exhausting the memory_limit of PHP, that is, PHP is trying to allocate an amount of memory greater that the memory_limit param value.
Maybe you're uncompressing the image on the fly or copying some data that needs too much memory to be allocated, try increasing that limit.
You have memory_limit in your PHP configuration; 54525952 bytes which is 52MB.
You should configure memory_limit in php.ini or .htaccess or fix memory leak.

Categories