1

I have the following settings in php.ini:

upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 300

My .htaccess file is empty and there is no function about uploading file size.

But still I can not upload file larger than 1MB. It gives HTTP error. (p.s. Page shows the maximum upload file size 100MB as I set, but not upload more than 1MB. Gives http error)

What may be the issue and how can I resolve it?

  • When you talk of nothing in your .htaccess file: where is that very .htaccess file located? It will be very strange if that were to be in the same directory as your WordPress project! Is it a WordPress Multisite? You may want to check this. – nyedidikeke May 29 '17 at 14:01
  • Are you sure you modified the correct php.ini? You should be able to see which is loaded with phpinfo();. Did you restart the webserver after the changes were made? Is this a multisite? – DaveLak May 29 '17 at 14:08
  • There is just # BEGIN WordPress # END WordPress in .htaccess file and it is located in wordpress core folder – ilker surmeli May 29 '17 at 14:55
  • Yes, I am sure I I modified correct.php.ini, because it shows in dashboard Media>add new media page "Maximum upload file size: 100 MB." but I can not upload more than 1MB. I tried different values also for max upload file size like 64M. Every time I modified php.ini it show the new value in dashboard Media>add new page, but does not upload more than 1MB – ilker surmeli May 29 '17 at 15:03
1

I had the very same problem. None of googled articles suggesting trivial solutions (like "resize image", "wait a bit") helped.

Symptoms: media uploading works perfectly, but only for some files (larger than 1Mb) the "HTTP error" occurs.

But when I tried to check my web server logs, everything became clear in one second. I suppose you use nginx (as I do), so:

  1. Check nginx logs: tail /var/log/nginx/error.log
  2. If you see errors like 10899 client intended to send too large body: 1198151 bytes, client: <IP address>, server: example.com, request: “POST /wp-admin/async-upload.php HTTP/1.1”, host: “example.com”, referrer: “http://example.com/wp-admin/post.php?post=<post id>&action=edit” than it's easy - your webserver is blocking requests larger than 1 Mb (nginx default)
  3. So modify your nginx config sudo vi /etc/nginx/nginx.conf
  4. Insert client_max_body_size 20M; somewhere in the [http] section.
  5. Restart nginx sudo /etc/init.d/nginx restart or sudo service nginx reload
  6. Check your site and make sure it works (or at least there are no more nginx errors in the log)

Reference: https://websistent.com/fix-client-intended-to-send-too-large-body-nginx-error/

-1

Although you can change the php.ini file, and other settings, I just use the "Upload Max File Size" plugin (https://wordpress.org/plugins/upload-max-file-size/ ).

Even though it hasn't been updated for 2 years, it still works for me. (What changes would need to be done to this simple plugin anyhow?) You do have to enter the file size in bytes, so a bit of math involved to get the number you want.

I suppose that I could dig into the plugin to see how it works, then manually change things. But it was much easier to use the plugin - it works fine for my purposes.

  • I tried the plugin already. Yes, increase the size same as my php.ini modification. Page shows upload maximum size as I set but when I tried to upload it gives HTTP error. – ilker surmeli May 29 '17 at 19:48
  • Which HTTP error? Error message? Can you do a php_info() on a test page to see if the values are really being set properly? Is your hosting place setting a max upload size? – Rick Hellewell May 30 '17 at 1:57
  • Http - error notification shows up when I try to upload a file bigger than 1MB on media>add new page. In info.php page the values are right now: upload_max_filesize = 64M, max_execution_time = 300, max_file_uploads = 20, post_max_size = 8M, memory_limit = 128M – ilker surmeli May 30 '17 at 5:40
  • Take a look here kinsta.com/blog/wordpress-maximum-upload-file-size . You may need to do all of those suggestions. And you may want to remove all mods that you have done to start over. Note that there might be additional php.ini files in subfolders that might overwrite your settings in the root folder. – Rick Hellewell May 30 '17 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.