How to increase your server's upload file size limit

If you're having trouble uploading larger pictures or if you are planning to import a very long list of users from a CSV file, it's time to have a look at your current server settings.

Thus,

  1. Download the System Info component from https://www.opensource-socialnetwork.org/component/view/1963/system-info
  2. Install and enable the component
  3. Navigate to http://YOUR_SITE_URL/ossn-system-info and have look at the PHP settings table on top

The parameter of interest is upload_max_filesize. If set to 2000000 or 2M, you won't be able to upload files which are larger than 2 Megabytes. The process of increasing this setting depends on the configuration of your server, though. Have a look at the PHP table again - this time we need to know the Server APi: It should be either apache2handler or cgi-fcgi.

Before proceeding: Remember FIRST to make a BACKUP of the files you are going to edit, since a mistake in a system file may result in Server 500 errors and a blank page!!!

As already said, the method of changing PHP settings depends on your server configuration. Here we go ...

Case A - Server APi: apache2handler

  1. open the file named .htaccess in the root of your Ossn installation
  2. find the line php_value upload_max_filesize
  3. change the value to fit the estimated size of the files you want to upload
  4. (you may either use the short notation like 15M or enter the value in bytes like 15000000 - both are interpreted as 15 megabytes)
  5. Move up one line to php_value post_max_size
  6. Change the value to be about 3 megabytes larger than the value of upload_max_filesize
  7. (i.e. if upload_max_filesize is 15M, then post_max_size should be 18M
  8. Save the changed .htaccess file and reload the Ossn System Info page again
  9. Your changes should be reflected in the PHP settings table, and larger file uploads should work now
  10. If not, please consult the support of your provider.

Case B - Server APi: cgi-fcgi

  1. Create a new file named php.ini in the root of your Ossn installation
  2. Open this file with a simple editor like notepad or notepad++
  3. Apply the following 2 lines
    post_max_size = 18M
    upload_max_filesize = 15M
  4. Save the changes

Now your upload limit should be increased to files with a size of up to 15 Megabytes. You may change the values to your requests, but note that the post_max_size always has to be larger than the upload_max_filesize.

Next, you need to add some stuff to your .htaccess file

  1. First, navigate to your System Info page and copy the setting of Install Dir to your copy buffer with CTRL-C
  2. open the file named .htaccess in the root of your Ossn installation
  3. append the following lines at the bottom
    <IfModule mod_suphp.c>
    suPHP_ConfigPath INSERT COPY BUFFER HERE WITHOUT TRAILING SLASH
    </IfModule>
  4. (the correct line should look like:
    suPHP_ConfigPATH /home/blabla/public_html/ossn
    Your own path may be completely different - important is the slash / in the beginning, but NO slash at the end.)
  5. Save .htaccess file

Now navigate to the Ossn Sytem Info page again and verify whether your changes are reflected in the output. If so, you should be able to upload larger files now.