Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
litespeed_wiki:troubleshooting:upload-large-file [2020/08/22 16:13] qtwrk [On external app part (typically PHP), you may need to check :] |
litespeed_wiki:troubleshooting:upload-large-file [2020/08/24 18:48] Lisa Clarke Copyediting |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Upload Large Files ====== | + | ====== Large File Upload Failures ====== |
- | In many site applications, user can upload files, some could be big file , like 1GB or bigger, but when upload such large file, many setting could have put a limit on it and cause you failed to upload it, here are some setting you may need to check when have upload failure on large file. | + | Many site applications allow users to upload files, and sometimes the files may be big, possibly 1GB or more. Such large uploads may fail if they are limited by server-level settings |
+ | If you are experiencing upload failures, here are some settings you can check. | ||
+ | ===== External App Settings ===== | ||
+ | Take a look at the following settings for external apps (typically PHP): | ||
- | ===== On external app part (typically PHP), you may need to check : ===== | + | * ''upload_max_filesize'' |
+ | * ''post_max_size'' | ||
+ | * ''max_execution_time'' - Some PHP scripts may need to do some post-upload processing, like resizing or watermarking, so ''max_execution_time'' could be a factor. | ||
+ | * ''memory_limit'' | ||
+ | * ''upload_tmp_dir'' - By default this would be ''/tmp''. Many systems limit this directory to 2GB in size, which can be a problem if you upload a file bigger than 2GB. If your ''/tmp'' is too small and you cannot resize it, you can choose to change the location. For example, you could make it ''/var/tmp''. This setting can not be overridden by ''.htaccess''. It must be set in ''php.ini''. Make sure the new directory has permission to allow the PHP user to read and write files. if you have ''open_basedir'' in action, the new path must be included there as well. | ||
- | 1. **upload_max_filesize** | + | ===== Server Settings ===== |
- | 2. **post_max_size** | + | * In **Server Configuration > General**, check **Swapping Directory** - This could be a problem for the same reason as PHP's ''upload_tmp_dir'' setting. You can change it to something like ''/var/tmp/lshttpd/swap'', with default ownership and permission as shown: <code> |
- | + | [root@test ~]# ls -l /tmp/lshttpd/ | grep swap | |
- | 3. **max_execution_time** (some PHP script may need to do some afterward process, like resizing or watermarking, so max_execution_time could also affect it) | + | drwxr-x--x 22 nobody nobody 4096 Aug 22 17:35 swap |
- | + | </code> | |
- | 4. **memory_limit** | + | * In **Server Configuration > Tuning**, check **Max Request Body Size (bytes)** |
- | + | * **External App Timeout** ([[litespeed_wiki:php:run-without-timeouts|Learn more]]) | |
- | 5. **upload_tmp_dir** (by default this would be **/tmp** , many system comes with default as 2GB in size , which if you upload a file bigger than 2GB, then it will undoubtedly fail because not enough disk space to save temporary file.) | + | * In **External App**, check **Memory Soft Limit (bytes)** and **Memory Hard Limit (bytes)**. If you don't see **PHP** under **External App**, then go to the **PHP** tab instead, and raise to a number higher than the default ''2047M''. For testing purposes, you could blindly raise it to something like ''20470M''. |
- | + | * **wait-req-full-body** ( [[litespeed_wiki:config:envirnment_variables#wait-req-full-body|Learn more]]) | |
- | ===== On LiteSpeed WebServer part, you may need to check:===== | + | |
- | + | ||
- | 1. **Swapping Directory** in **Server Configuration** > **General** (same reason for PHP's **upload_tmp_dir** ) | + | |
- | + | ||
- | 2. **Max Request Body Size (bytes)** in **Server Configuration** > **Tuning** | + | |
- | + | ||
- | 3. **External App Timeout** , please check this [[litespeed_wiki:php:run-without-timeouts|page]] for further detail. | + | |
- | + | ||
- | 4. **Memory Soft Limit (bytes)** and **Memory Hard Limit (bytes)** in **External App** , if you don't see any PHP shows up in **External App** then please go to **PHP** tab instead, raise from default ``2047M`` to a higher number , you can blindly raise it to something like `20470M` for test purpose. | + | |
- | + | ||
- | 5. **wait-req-full-body** , please check this [[https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:config:envirnment_variables#wait-req-full-body|page]] for further detail. | + | |
- | ===== Test ===== | + | ===== PHP Testing Script ===== |
- | Here is a simple PHP upload script , you can use it to test the upload with large files. | + | Here is a simple PHP upload script that you can use to test large file uploads. |
<code> | <code> | ||
Line 80: | Line 76: | ||
</code> | </code> | ||
- | this will simply to determinate if there is something wrong with PHP/LSWS or your site application. | + | This will simply determine if there is something wrong with PHP, LiteSpeed Web Server, or your site's application. |
- | If this script uploading works , but your site's uploading is not working properly , then probably something wrong in your site code , you may need to check on that. | + | If this script works, but your site is still experiencing uploading problems, then there is probably something wrong in your site code. |