Changing the upload_max_filesize in php.ini

There are a few common errors that occur in WordPress and other PHP-based programs that use the php.ini for certain settings. One of the most common of these settings is the maximum upload filesize (“upload_max_filesize“). This is a setting commonly found within a file known as the php.ini file.

Here’s an example screenshot of a program with max file size limits exceeded during an upload attempt:

Upload error occurring in WordPress due to PHP.INI limit

Error text: file_name” has failed to upload due to an error – This file exceeds the maximum upload size for this site.

You will need to increase the allowed memory in your php.ini file. The instructions below will show you on how to fix the php memory error by adjusting the appropriate sections of your local php.ini file.

Fixing the “Maximum upload size exceeded” Error

  1. Login to your cPanel.
  2. Scroll down to the FILES section of your Cpanel, and then click on the icon labeled FILE MANAGER.
  3. Use the File Manager to navigate to the web root. For more information on understanding your web root or document root, see What folder are my website files located within?
  4. Locate the php.ini file in your public_html folder. If you do not have one, our Technical Support team can place a default one in your account, or you can create a blank file by clicking on the New File icon and naming it php.ini so you can edit and add your own settings. Once you have a php.ini file, click on the file name to highlight it in the right side of the File Manager. If you need further information on editing with the File Manager editors, go to Using the File Manager Code Editor.
  5. Search the php.ini file for the following text:
    ;;;;;;;;;;;;;;;;
    ; File Uploads ;
    ; ;;;;;;;;;;;;;;
    
    ; Whether to allow HTTP file uploads.
    file_uploads = On
    
    ; Temporary directory for HTTP uploaded files (will use system default if not
    ; specified).
    ;upload_tmp_dir =
    
    ; Maximum allowed size for uploaded files.
    upload_max_filesize = 128M
    
    

    The file_uploads should be set to “on” and “Maximum allowed size for uploaded files” should be set to the file size that you need.

  6. Click the Save Changes button to save your changes.

This change affects all files within the directory that a php.ini is saved, unless the file is set to be recursive.

If it is set to be recursive, then it affects all directories as per the setting in the .HTACCESS file.  For more information, see How can I make my php.ini file recursive?

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

28 thoughts on “Changing the upload_max_filesize in php.ini

  1. after increasing the upload file size I am still getting the error partially file uploaded though I have increased the size upto 4096M

    1. It is likely the file upload is hitting a different server load limitation. I advise using a different file management method for uploading, such as FTP or SCP.

  2. i have a problem this what can i do The file size exceeds the size allowed by the server. The limit is set to 8 MB.

    1. In that case, you will need to contact your hosting support to see if that is something they are willing to change.

  3. Error

    There was an error uploading this file to the server.
    Maximum PHP file upload size is too small: This is set in php.ini in both upload_max_filesize and post_max_size settings of your PHP settings (located in php.ini and/or .htaccess file).
    Unable to find install package
  4. Always hilarious when some noob comes on a forum declaring that something is “absurd” and then proceeds to lay out all the ways he’s ignorant and clearly not a dev and should never BE a dev (with that attitude).

    How about just admitting “i don’t know jack shit. this seems not to make sense, therefore there’s something i’m missing” instead of declaring with no knowledge whatsoever that something is “absurd”

    People like you trying to making websites is absurd. Go lick a window.

  5. Hi,

     

    I tried this process bit I am still getting file is too large message. what other solution do i have. i am just trying to upload PFD with 8MB size

  6. Hello Sir,

    My project is to upload a video with a maximum file size of 3 GB but it’s not uploading. I am changing my php.ini file, and manually linking the page. I need help.

  7. Hello, I have set the php.ini as stated above and set the file to be recursive however My maximum file upload size is being set to 8mb. When I set a size limit of less than 8 it changes the value on my WP site, but anything above 8m will default back to 8mb on my site.

    1. If you are in a shared server, it’s possible there is a server default upload limit. For example, a shared server at any given hosting company can have a few hundred customers on one account. If each customer were allowed to upload large files (over a GB or more) then there would be a serious resource crunch.

  8. Absurd. Every person who uses it needs to upload wordpress themes and the default setting is smaller than most themes. Why? Why doesn’t your article address how large can it be? Why is it set so small? What does 512m even mean? Does that mean 512MB? Why can’t you just take 5 minutes and write a meaningful explanation. 

    1. php.ini is not made for WordPress, it is a general configuration file set for php. WordPress just happens to be one of thousands of programs that are coded in php. As for a max size, you should not make it any larger than is needed. You COULD make it 1GB if you wanted (1000M) but you may have to move to a VPS or Dedicated server if you were using that many resources. Yes, 512M means 512 MB. 1G means 1GB. The php.ini file just doesn’t have the need for the B at the end.

      So far no one else has notified us of any confusion, so we are not sure where this is occurring. We are happy to expand or make the article more clear if you can tell us exactly where you are getting confused. This of course goes for anyone.

  9. Hi,

    On my webserver, I can’t find a ‘php.ini’ file. I created one, and copied the code snippet from this page, but it hasn’t increased the file size.

     

     

    Thanks

    Seth

    1. Hello Seth,

      Sorry for the problems with the PHP.INI file. The problem may be the file itself (based on its entries), or that the file is not applying to the installation. Try making the file recursive. We have a tutorial that can show you how to do this. If that doesn’t help, then please submit a verified support ticket to have the php.ini file placed in your account.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  10. First am a creative designer and not a teche guy… but i use to work with the help of google. when i tried to upload a theme it says excwwds the upload limit 2M. and tried to solve it the way it is mentioned. But PHP.ini file was missing in my folder. then i created it and copied the code which is given here and changed the limit alone and saved it. But still it is showing me the same error. Can u pls help me to take it through.

    1. Hello Ludaking,

      It’s possible that you have a PHP.INI file that is local to your installation, or one that’s sitting on top of your installation that is redundant and affecting all of your installation. Please check for that. If you continue to have the problem, if you are a customer of InMotion we can look at your installation to see if there are any errors being generated, but we would need some account information.

      I hope that helps to answer your question! If you require further assistance, please let us know!

      Regards,
      Arnel C.

    1. Hello Asomix,

      Sorry for the problem with WAMP. We unfortunately do not support it as it involves the use of a server outside of the typical hosting environment. Our answers are based on a hosting server installation. Typically, in order to upload files (like graphics), you would need to know how to use FTP – that would be the best way to put files into the website.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  11. I am using WAMP SERVER. Thanks alot. Please any idea how to upload sample_data contating pictures and media in general to a wordpress theme like interior woo commerce. Thanks.

Was this article helpful? Join the conversation!

Server Madness Sale
Score Big with Savings up to 99% Off

X