Search code examples
upload-max-filesize

Is there any method to know what is maximum upload limit for WordPress in cPanel and increase it?


Maximum upload size in my case was only 1 MB. I started to search in settings in the WordPress dashboard but no any settings for that, started to solve it by finding few errors and recommendations that was declared in WordPress site health. I found two recommendations as follows.

!WordPress site health performance recommendations

and in google search I found that this can be changed in cPanel in "select PHP version", but this feature was unavailable, I found this message ""PHP Selector is not available. Please, contact your hoster."

Than I installed plugin that solved my problem.

One of google search I found to add php.ini file in database and put following codes. For PHP.INI file

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

OR

upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 400M
file_uploads = On
max_execution_time = 180

But after creating this file hosting service put in suspension for sometime. So, is there any safe method to increase upload file size of galary.

Where is current defined file size by hosting service?


Solution

  • You can easily increase the size limits by adding the following lines of code in the functions.php file of your theme.

    However, remember if you change the theme then max upload size will return to its default values until you edit the functions.php file of the new theme.

    @ini_set( 'upload_max_size' , '64M' );
    @ini_set( 'post_max_size', '64M');
    @ini_set( 'max_execution_time', '300' );
    
    1. php.ini Option

      upload_max_filesize = 25M post_max_size = 13M memory_limit = 15M

    enter image description here

    1. Or you can do from wp-config.php File

    enter image description here

    Open the file in any text editor and add the following code.

    @ini_set( 'upload_max_size' , '20M' );
    @ini_set( 'post_max_size', '13M');
    @ini_set( 'memory_limit', '15M' );