I'm trying to upload large files to my server (my server support post_max_size
192mb and max_execution_time
600 sec). When I upload 100mb files execution will stop after 600 sec so files are not uploaded to the server. How can I increase max_execution_time
in PHP (only for the file uploading process)? I have tried:
ini_set ( 'max_execution_time', 1200);
if(move_uploaded_file($_FILES['Video']['tmp_name'],$tmppath)) {
// ...
}
Any ideas how I can overcome this?
Add this to an htaccess file:
Read more about those settings at
http://www.pacecode.com/blog/2008/09/22/magic-with-htaccess-file-increase-execution-time-session-expiry-time-and-file-upload-size-limitEDIT
It looks like the content of the original article was reproduced here: http://www.rajamm.info/2008/09/22/magic-with-htaccess-file-increase-execution-time-session-expiry-time-and-file-upload-size-limit
For increasing execution time and file size, you need to mention below values in your .htaccess file. It will work.
if you have access to WHM you can follow these steps:
At some point in time, you'll probably need to adjust PHP's configuration options. Instead of manually editing the PHP.ini file, you can do so from within WHM.
1) Find the Service Configuration menu.
2) Click PHP Configuration Editor.![enter image description here](https://i.stack.imgur.com/3lF56.png)
This editor has two modes -- Basic and Advanced. In order to have access to the fullest range of options, you will need to use the advanced mode. It is available by clicking the button at the top of the page.
We recommend that you wait to change any of the advanced settings until you're certain you know what you're doing. If ever you'd like more information about a setting, clicking a link in the Section column will take you to the PHP documentation. The first option in Basic Mode is upload_max_filesize, which limits the maximum size of a file uploaded through PHP. This option will affect the attachment or upload system of a wide variety of software likely to be run on your server, including Joomla and vBulletin. You'll probably want to change this to something quite a bit higher than the default. Specify the size in megabytes by using a number followed by M. You will rarely need to change the include_path from the default. In addition to limiting the max upload size, you can also turn off file upload altogether with the file_uploads setting. Some PHP programmers have a bad habit of using shorthand tags, which aren't enabled on many servers. This means their scripts will not function. Enable asp_tags if you encounter any scripts that require that kind of tag.
With memory_limit, you can impose a limit on the amount of memory a particular PHP script can use at any given time. Enabling register_globals is not recommended unless absolutely necessary. It's the source of many security problems and will be removed completely when PHP 6 is released. The max_execution_time setting prevents poorly-written scripts from tying up the server. By default, this option is set to 30 seconds; don't put this too high, or your server's performance may suffer. Similarly, max_input_time places a limit on how long a script is allowed to parse input data, such as forms and file uploads.
With enable_dl, all users can include PHP extensions at will. This represents a potential security breach, so you should turn this off unless absolutely necessary. safe_mode is another PHP option that will be removed with the release of PHP 6. It's largely ineffectual, and should probably be left off. The last option, session.save_path, controls where PHP's sessions are saved. The default should be okay for most purposes.
If you wish to change this option, you'll need to click here for the text field to appear.
3) When finished, click Save.
The php.ini file has been written automatically.
You now know how to configure PHP from within WHM.
Theres a setting
max_input_time
(on Apache) for many webservers that defines how long they will wait for post data, regardless of the size. If this time runs out the connection is closed without even touching the php.So your problem is not necessarily solvable with php only but you will need to change the server settings too.