Related Services:

  1. Linux Shared Hosting

Problem:

You are using a WordPress website to upload your favourite plugin or theme and you notice that there is a limit on max size upload limit. Or you are a PHP developer and want to use the upload function of PHP to upload files. 

Example: 



Solution:

By default, the shared hosting plan has a limit of 50MB for PHP functions, This can easily be overwritten by several methods:

  1. Change PHP upload Limit Using Cpanel MultiPHP INI Editor
  2. Update Your ‘.htaccess’ File for changing the PHP upload function

Change PHP upload Limit Using Cpanel MultiPHP INI Editor

To get started, go to your cPanel dashboard, A link for the Cpanel login link must be provided in your welcome email while you have activated your services. (If the default password is not working please refer to : Change Cpanel Password)

  • Once inside the Cpanel look for MultiPHP INI Editor, Which looks something like this under the software session

    cPanel-MultiPHP INI Editor


  • Click on MultiPHP INI editor, and under the Basic Mode, select the right domain name as shown in the screenshot below 





  • Once the domain is selected, the system will show all the possible and editable changeable limit 



    Look for The maximum size of an uploaded file and enter the desired limit. 

    Once done click on the save option and you are done with the change in the limit for the PHP Max upload limit.

Update Your ‘.htaccess’ File to change PHP Upload Limit

Login to Cpanel and look for the file manager (How to access cPanel File Manager) once logged in You can find your .htaccess file in the website site’s root directory. 
which is the public_html folder.

As per PHP documentation, three PHP directives are responsible for how WordPress handles uploads. They are:

  • upload_max_filesize
  • post_max_size
  • memory_limit

Access your .htaccess file which will look like this under public_html folder



Open the .htaccess file with a code editor, and then add the following code: (change the limit as per your requirement)

php_value upload_max_filesize 32M
php_value post_max_size 64M
php_value memory_limit 128M
php_value max_execution_time 300
php_value max_input_time 300

That's it, You have successfully changed your PHP upload limit.

Was this answer helpful? 0 Users Found This Useful (0 Votes)