Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  How-Tos  >  How to change the maximum upload size in php.ini?
Top Scroll

How to change the maximum upload size in php.ini?

 2 min

There are a couple of common errors that you may encounter with while using WordPress and other PHP-based programs that use the php.ini for certain settings. One of the most common is the maximum upload filesize settings (“upload_max_filesize“). This setting can be found within a file known as the php.ini file.  Below is an example screenshot of a program with max file size limits exceeded during an upload attempt:

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

To fix this error, you will need to increase the allowed memory in your php.ini file. The instructions below will help you to fix the php memory error and for this, you will need to make some adjustment in the appropriate sections of your local php.ini file.

Fixing the “Maximum upload size exceeded” Error

Step 1: Login to your cPanel Control Panel.

Step 2: Scroll down to the FILES section of your cPanel, and then click on the FILE MANAGER icon.

Step 3: Use the File Manager to navigate to the web root.

Step 4: Search for php.ini file in your public_html folder. If the file is not there, you can ask our Technical Support team member to place a default one in your account or you can simply create a blank file by clicking on the New File icon and naming it php.ini. Once you are done, you can edit and add your own settings.

Once you have a php.ini file, click on the file name to highlight it on 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.

Step 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 will need.

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

Related: How to set the Timezone for PHP in the php.ini file

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 our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.