What best practices should be followed when setting upload limits in PHP configuration files to avoid memory limit errors?

When setting upload limits in PHP configuration files, it is important to consider the memory limit to avoid errors. To prevent memory limit errors, it is recommended to increase the upload_max_filesize and post_max_size values in the php.ini file to accommodate larger file uploads. Additionally, it is advisable to set the max_execution_time to allow for enough time for the server to process the uploaded files without timing out.

upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 300