skip to Main Content

I need to upload a PDF file to my wordpress site. When I go to Upload New Media, and try uploading it, it says

FileName.pdf exceeds the maximum upload size for this site.

I tried looking for my php.ini file but could not find it. I ran phpinfo() by creating a new file and then opening it in my browser and found this.

Configuration File (php.ini) Path 
C:Windows

Loaded Configuration File 
C:Program Files (x86)ParallelsPleskAdditionalPleskPHP5php.ini

I placed a php.ini files with

upload_max_filesize = 512M
post_max_size = 512M
max_execution_time = 300

in wp-admin, httpdocs and everywhere I had access, nothing worked The max upload file size is just 8 MB. Please help me, My client needs to upload that file.

Note: Please don’t tell me to restart server, as I can’t, It is a hosted site.

8

Answers


  1. Seeing as you’re on hosted service, try adding these to your .htaccess file as well:

    php_value upload_max_filesize 512M
    php_value post_max_size 512M
    

    You won’t be able to change these via ini_set();

    Login or Signup to reply.
  2. Try with the following plugin:

    <?php
    /* Plugin Name: Increase Upload Limit */
    
    add_filter( 'upload_size_limit', 'b5f_increase_upload' );
    
    function b5f_increase_upload( $bytes )
    {
        return 33554432; // 32 megabytes
    }
    

    I built this code based on the following core function:

    function wp_max_upload_size() {
        $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
        $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
        $bytes   = apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
        return $bytes;
    }
    

    Another option is upload via FTP and use the plugin Add from Server.

    Login or Signup to reply.
  3. I tried different way like attempted to

    1. change my limit directly on my server
    2. through the .htaccess file
    3. wp-config.php

    but none of these changes worked for me. Then I came across a post somewhere That I summarised in a blog post(find below)

    All you need to do is

    1. create a php.ini
    2. upload to admin directory

    Your Php.ini may contain following or whatever limit you need

    memory_limit = 32M
    upload_max_filesize = 32M
    post_max_size = 32M
    file_uploads = On
    
    Login or Signup to reply.
  4. What worked for me was editing the php.ini file at

    /etc/php5/apache2/php.ini
    

    and adding/editing the following options starting (~ line 786):

    memory_limit = 32M
    upload_max_filesize = 32M
    post_max_size = 32M
    
    Login or Signup to reply.
  5. WHM/CPanel users Only

    I have been struggling with this for a while now, I found the most simple way to solve this to login to your WHM > PHP Configuration Editor > Change (upload_max_filesize) then hit “SAVE”.

    This makes a change to your server’s php.ini file (the simple way).

    Login or Signup to reply.
  6. You have written php.ini file properly. Just mention path of your php.ini file inside .htaccess file using suPHP_ConfigPath/home/username/public_html. Here replace username with your username mentioned in cpanel. You can refer http://www.vinaypn.com/how-to-fix-maximum-upload-size-exceeded-error-in-wordpress-running-on-shared-hosting/

    Login or Signup to reply.
  7. This applies to cPanel users only. I’m not sure about which versions of cPanel it will work with, but it works with the version 56.0.33.

    Login to cPanel > Select PHP version > Switch To PHP Options > Click the greyed out number next to upload_max_filesize > Change > Save

    I believe this makes a change to the server’s php.ini file.

    Login or Signup to reply.
  8. I’m running WHM / cPanel on a CloudLinux based server. I tried everything. The final solution for me was adding a php.ini file to the /wp-admin/ directory with the following;

    memory_limit = 128M
    upload_max_filesize = 32M
    post_max_size = 32M 
    

    Keep in mind I previously tried a php.ini in the document root and the web root directories and those didn’t fix the max upload limitation.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search