Problem

If you use any PHP programs as your web server you may run into this problem: “This file is too big. The maximum upload size for your server is 2M” as shown in the picture below. 2M is the default size in most PHP installations. You can change the default size settings of your server.

PHP Program Complains Upload Exceed LimitSolution

To change the default upload file size, you should do the following:

  1. Access your PHPinfo.php file to see your current upload file size. As shown in the picture below, the upload_max_filesize is 2M.PHP Upload Settings in PHPInfo.php
  2. Note down your php.ini file location. This server puts php.ini in /etc/php5/apache2/php.iniPhp.ini File Location
  3. Access your server with any remote access tools
  4. Find following lines in your php.ini. php.ini upload Settings
  5. Change the settings to fit your need. Picture below sets the maximum upload file size to 100M. php.ini Upload File Size Changed to 100M
  6. Restart Apache server for Apache server to use new setting.Restarting Apache Server
  7. You can check your phpinfo.php file to see the new upload file limit. PHP Upload Settings New LimitNotes
  8. If you can not change php.ini for your whole server, you can add following two lines to your .htaccess file for your web directory. However, if your web server does not listen to .htaccsss at all, you addition will not work.
    .htaccess addition