Increase File Upload Size Limit

I am working on a project that requires high-level users to be able to upload more than the default WordPress file-upload limit. I’ve done this in the past but I have set it to a multi-domain setting. Meaning that it encompasses all of my domains being hosted in a particular Dreamhost user account.

I wanted to only increase the file size (again) to something much larger than I’ve had before but only for a particular subdomain; as I was using it for staging. Here’s the process that I took to make that happen. ((These steps are a paraphrase from Dreamhost’s Wiki article.))

For all domains being hosted by the user:

  1. Be sure that you have PHP 5.3 (FastCGI) if you can, or 5.2 if you need to use the older version, for your domain.


    You may check this in your Dreamhost management panel > Domains > Manage Domains > Edit (for your particular domain).

  2. With the above setting set, execute the following command via Bash/SSH:
    mkdir ~/.php
    mkdir -p ~/.php/5.3
    touch ~/.php/5.3/phprc
  3. Edit your phprc file with your favorite editor, enter the following settings and save:
    upload_max_filesize = 16M
    post_max_size = 16M

Refresh your WordPress file-upload page and you should now see the update and increase in your file-upload size limit. If you would like to only increase the setting on a particular domain like me, follow the steps below.

Domain-only increase

  1. Presuming that you have set your environment to PHP 5.3 (FastCGI) as in step #1 above, first create a cgi-bin folder for your domain
    mkdir $HOME/
  2. Clone the default php.ini file
    cp /etc/php5/cgi/php.ini $HOME/
  3. Create the script wrapper by executing the following in your shell (SSH/Bash)
    cat << EOF > $HOME/
    exec /dh/cgi-system/php5.cgi \$*
  4. Set the permissions to your files and directories; execute the following also in your shell:
    chmod 755 $HOME/
    chmod 755 $HOME/
    chmod 640 $HOME/
  5. Set up your .htaccess file located in your document root $HOME/, and include the following:
    Options +ExecCGI
    AddHandler php5-cgi .php
    Action php-cgi /cgi-bin/php-wrapper.fcgi
    Action php5-cgi /cgi-bin/php-wrapper.fcgi
  6. Last but not least, update your cloned php.ini file (the one residing in your $HOME/ with the size increase. For example:
    upload_max_filesize = 16M
    post_max_size = 16M

The above will allow you to run your PHP files with the custom wrapper we have created, and increase your file-upload size limit for your PHP applications (e.g. WordPress). Hope that helps!