When a site needs a bigger upload limit, more memory or a longer timeout and you don’t have access to the server’s php.ini, you can often change the setting from the site’s .htaccess file instead. These are the directives I need most often, with the syntax for .htaccess.
Before you use these php_value and php_flag only work when PHP runs as an Apache module (mod_php). If PHP runs through PHP-FPM, FastCGI, CGI or suPHP, which is common on shared hosting and cPanel servers, Apache doesn’t recognise these lines and the whole site returns a 500 Internal Server Error. In that case put the settings in a .user.ini file in the same folder instead, using php.ini syntax (upload_max_filesize = 20M). PHP rereads .user.ini files every five minutes by default, so changes can take a little while to show up. Not every directive can be changed per folder. Settings marked PHP_INI_SYSTEM in the PHP manual can only be set in php.ini, and a line for them in .htaccess won’t take effect. I’ve noted which ones below. Use php_flag for on/off settings. The PHP manual says php_value shouldn’t be used for boolean values. php_flag log_errors on is the recommended form; php_value is for numbers, sizes and strings. Check the result. Create a temporary PHP file containing <?php phpinfo(); ?> in the same folder and open it in the browser. The “Local Value” column shows what applies to that folder, and “Master Value” shows the server default. Delete the file when you’re done, because it shows a lot about your server. The directives Maximum Execution Time and Maximum Input Time php_value max_execution_time 300 php_value max_input_time 300 max_execution_time is how many seconds a script may run before PHP stops it (the default is 30). max_input_time is how many seconds PHP may spend reading the request data, such as POST fields and uploaded files. Raise both for long imports, exports or large uploads over slow connections. A proxy or load balancer in front of the server can have its own timeout that cuts the request off earlier.
...