Problems uploading large files in WordPress – the *second* php.ini setting

February 24th, 2009 by Dan York

Recently I spent some time working on our site and making it so that I could upload large media files directly through the WordPress web interface. In doing so, I ran smack into the default limit of 2 MB on file uploads. I spent time in the WordPress support forums and found the general consensus that you needed to change the upload_max_filesize setting in your /etc/php.ini file to be larger. So I changed that setting to “100M”, restarted Apache and thought I would be all set.

However, this still didn’t let me upload larger files. In fact, the result was somewhat comical in that the WordPress error message said “You cannot upload files larger than 100M” – but yet my files were far smaller than that. It turned out in further investigation that there is a second setting in php.ini that needed to be changed: post_max_size, as in “the maximum size of a given blog post”. That was also set to “2M” and was therefore gating my upload. A quick change to make both look like:

upload_max_filesize = 100M;
post_max_size = 100M;

followed by a restart of Apache… and I was uploading away. I’m writing this here mostly so that I remember for other WordPress installs – and in the hopes that it helps someone else out there…


If you found this post interesting or helpful, please consider either subscribing via RSS or following on Twitter.


Technorati Tags:


Related posts:

  1. Supporting OpenID, part 2a: Setting up WPMU to accept OpenID logins

Tags:


If you found this post interesting or helpful, please consider either subscribing via RSS, becoming a fan on Facebook, or following us on Twitter.


4 Responses to “Problems uploading large files in WordPress – the *second* php.ini setting”

  1. Zelimir Says:

    Hi,

    I have the same issue with my blog. But I can`t seem to find the etc/php.ini file. Could please explain in more detail as to where I could locate it on my server, and how to restart the Apache. I have a hosting account at Hostmonster. Thanks Zelimir

  2. Dan York Says:

    Zelimir, Unfortunately, you are probably going to have to talk to your hosting provider to sort out exactly what you can or cannot do. On a Linux system, the php.ini file is typically found in:

    /etc/php.ini

    On some Linux systems I have found that there might be a “php” subdirectory in /etc/, so the file might be /etc/php/php.ini. Or something like that. But it’s something you’ll have to ask your hosting provider about. Likewise re-starting Apache is probably specific to your host. On many Linux systems you can do something like:

    /etc/rc.d/init.d/httpd restart

    (as the root user) Again, this will vary according to what Linux distribution you are using. Sorry I can’t be of more help, but it really is dependent upon what your hosting provider makes available to you.

    Dan

  3. Mad Says:

    Thanks a lot! Just got same problem.

  4. Dan York Says:

    You are welcome. Glad the post was helpful.

Leave a Reply

Please note: By submitting a comment you agree to comply with our Comment Policy. We welcome all comments, positive or negative, but do reserve the right to remove all or part of blog comments that do not comply with our policy.

Additionally, the first time you leave a comment on this blog, it will be held for moderation. After that first comment has been approved, future comments will be posted without delay.

Additional comments powered by BackType