There are a few things you can do to increase the PHP file upload size limit. The first is to make sure that your website is using the correct PHP version. If you’re not using a specific PHP version, then you can increase the file upload size limit by setting a higher value for the php_file_upload_max_size setting in your web server’s configuration. The second thing you can do is to use less memory when uploading files. This will help reduce the amount of time it takes for your website to upload files and will also help reduce the amount of data that needs to be stored on your server. The last thing you can do is to use a compression algorithm when uploading files. This will help reduce the amount of data that needs to be stored on your server and will also help reduce the amount of time it takes for your website to upload files.
The reason the limit is set fairly low by default is for stability and security reasons – a malicious script or attacker could attempt to DoS your server with large file uploads and temporarily shut your application down.
To change the values you’ll need to edit your php.ini file, normally found at this file path:
Here are the settings you want to change:
post_max_size This setting controls the size of an HTTP post, and it needs to be set larger than the upload_max_filesize setting.
upload_max_filesize This value sets the maximum size of an upload file.
memory_limit You’ll want to make sure your script memory limit is set to a decent size, probably larger than either of the other two settings.
Setting the Variables
You can set the values by using a numeric value followed by M for the amount of MB you want to allocate for each variable. For instance, to allow 20MB files to be uploaded, you’d use something like this:
You’ll need to restart your Apache server once you’ve made this change, with this command:
Setting the Upload Size Per Application
You can make this setting change for a specific web application by putting it into the .htaccess file instead, in the directory of the application. Note that this will only work if your server has enabled overrides for your virtual host or server.
For instance, you could put the following into the file:
Once you save the file, the changes should be applied.