How to Increase the PHP file upload limit to handle large files #large files upload
Edit
by Antoni Canals - 3 months ago (2025-08-03)
Use Apache Web Server and PHP to process files with size over 2G
| I am using the Apache server with PHP and there is a limit of the size of files that can be uploaded to the server to 2GB.
Is there a solution to avoid this limit? |
Ask clarification
1 Recommendation
This class can track the progress of file uploads using sessions.
It can check a session variable assigned to keep track of the progress of a file upload.
The class can return the current upload progress value in percentage.
The class can set the session variable to cancel a file upload in progress.
It can also move the file to a given directory after the upload has finished.
| by Manuel Lemos 27250 - 3 months ago (2025-08-10) Comment
Antoni, first, you need to make sure PHP is configured to handle files of the size limit that your PHP application is expected to handle.
In the php.ini file, you may need to change these options:
-
Set the upload_max_filesize option to the largest file size that you want your PHP application to process.
-
Set the post_max_size option to a value higher than you set the upload_max_filesize value.
-
Set the memory_limit option to a high value or -1 to have any limit:
-
Then you need to configure Apache to handle requests of large HTTP request bodies using the LimitRequestBody directive:
-
After you change these options, make sure you restart your Web server that runs PHP, so configuration file values take effect.
- The package above can be used to show a progress bar while a large file.
|