Do you have a client who wants to upload videos and other big files through the MODX back-end? MODX makes it easy to set the upper limit for file uploads via the MODX Manager:
System » System Settings » Filter by area: File System » Maximum upload size: change key value to number of bytes you want as maximum.
Simple, right? However, in some cases (or maybe all cases, I just never noticed before LOL - most recently I found this in a MODX Evolution site) the file upload limit set in the php.ini file on your server will take precedent. **update: see Mark's comments below
Every server is different, but the php.ini file can be located in /etc/, /usr/lib/, or usr/local/lib/ or any number of places. The BEST thing to do is just ask your hosting company. THEN duplicate that file into the web root, or /public_html/ folder on the account.
This can be done via the File Manager in your site's admin panel, like cPanel OR because some folders (like /usr/lib/) are hidden from the File Manager you can do it via the SSH copy command "cp". The command line (after logging in via SSH) is:
"cp /existing/path/to/php.ini /new/path/to/public_html/php.ini"
Strip the quotes and replace the directory names with the ones from your server. Now you can open that new php.ini file (the one in the web root) in your FTP client or File Manager in cPanel, and edit the lines:
upload_max_filesize = 20M post_max_size = 40M max_execution_time = 200 max_input_time = 200 memory_limit = 60M
Break it down:
- upload_max._filesize » maximum filesize in Mb
- post_max_size » without going into details, this should be bigger than upload_max_filesize
- max_execution_time » uploading big files takes longer, so set this to a high value in seconds
- max_input_time » same as above, in seconds
- memory_limit » this should be larger than post_max_size, just to be on the safe side
If you copied the default php.ini file like I showed you above, you might have to hunt around a little for these lines, and of course you'd enter the values you need for your situation.
This new php.ini file should override the system default if it's in the account's web root, AND it will do so on the next http request (no need to reset the server).
Thanks to @swscripts and Site5 hosting for help on this.
NOTE: in some hosts, like Bluehost, you can go to cPanel » PHP Config and there's a button there to "generate a new php.ini default". It will place a copy of the default file in your web root, and name it "php.ini.default". Simply edit this file and rename it "php.ini" and you're done!
If anyone knows about a theoretical upper limit that you just should not set the upload values higher than, please leave a comment below. For example, can PHP handle a 900Mb file even if you set it to? Do tell...