How to change maximum upload size 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.
      4. Locate the php.ini file in your public_html folder. 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

       should be set to "on" and "
Maximum allowed size for uploaded files
    " should be set to the file size that you need.
  1. 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. 

If you got this error while installing a WordPress Theme, then you will need to put this php.ini file under the wp-admin folder for it to be effective.

  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

How to change the primary IP address of a cPanel server

Steps in WHM: Log into WHM and go to Basic cPanel & WHM Setup Change the Primary IP here...

How to install WordPress with Docker on Ubuntu 16.04

Before we start, it is necessary to install Docker and Docker Compose. On Ubuntu 16.04, this can...

How to enable the gzip/deflate in nginx server on a Linux or Unix system

Ever thought of enabling gzip compression on nginx web server for JS/CSS/HTML files? Here is...

How to Upgrade Kernel to Latest Version in Ubuntu

It is important to keep your systems up-to-date, here we'll show you how to upgrade your kenerl...

How to configure SQL server in Linux

Problem You installed SQL Server on Linux and need to customize the default installation, for...