Adjusting the maximum file upload size on your Apache server for PHP, WordPress, Joomla, and Drupal

Your Apache server usually comes with limits on file sizes you can upload. The default upload file size is usually only 2MBs, usually not even the average size of a jpg iamge these days.  You will need to set the following 3 configuration options:

  1. “memory_limit” – The maximum amount of memory that a script is allowed to allocate.  Basically, this prevents scripts from using up all available memory on a server
  2. “upload_max_filesize” – maximum size of a file
  3. “post_max_size” – Max size of form post data.

Usually, “memory_limit” needs to be greater than “post_max_size”.  You will usually be able to edit settings in your .htaccess files.  WordPress comes with an .htaccess file located in the root of the WordPress installation.

Add following code to your.htaccess file after the “#End WordPress” comment, if it exists.  If you update your .htaccess file inbetween the “#Begin WordPress” and “#End WordPress” comments, the next time you update almost anything in WordPress you will end up losing these customizations because anything between these two comment lines are considered proprietary by WordPress and will be overwritten!   Keep this in mind, it’s a pitfall for those web developers new to WordPress!

Here are some basic settings to help you get started, you can adjust the values below to accommodate your needs.  For some servers and hosts, you may not have access to the .htaccess file, you could still accomplish adjusting these settings perhaps in the “php.ini” or other configuration file from your host’s cpanel, but there are no guarantees.  Often, hosts limit your values so whatever you enter they will take them to your allotted maximum but you will never be able to exceed them, without asking them to accommodate.  After all, they have to limit the “unlimited bandwidth and storage” claims they make somehow.

php_value post_max_size                           64M

php_value upload_max_filesize               48M

php_value memory_limit                            256M

About Author:

Senior Cloud Software Engineer and 25+ years experienced video production, video editing and 3D animation services for a variety of global clients including local video production here in Jacksonville, Florida.

Leave a Comment

Your email address will not be published. Required fields are marked *