Problem with uploading large files in PHP

2

I already set my site's php settings to the upload limit size ( post_max_size and upload_max_filesize ). I put 1 Giga as a precaution for the tests.

But when I try to upload a 30-megabyte file, the status bar shows the progress of the upload, and I noticed that the browser attempts to upload twice and then crashes into a browser's own error page. p>

Upload always falls in different percentages, so I guess that's not a space limit problem. And files up to 5 megs are being loaded normally without any errors.

I usually upload per ftp of larger files.

Would this be because of server instability? How does this process work and how do you control it? Can I persist more than 2 times in the upload?

UPDATE

Answering the question, the server is apache. And the error time is 1 minute. In php info I searched for number 60 (to see some timeout of 60 seconds configured) and I changed all that I found for more. The error persists.

Follow my php settings:

[PHP]
asp_tags = On
include_path = ".:/usr/share/pear"
ignore_repeated_source = Off
variables_order = "EGPCS"
track_errors = On
output_buffering = 4096
doc_root = 
log_errors = On
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
auto_append_file = 
disable_classes = 
enable_dl = Off
display_startup_errors = Off
user_dir = 
extension_dir = "/usr/lib/php/modules/"
register_argc_argv = On
display_errors = On
allow_call_time_pass_reference = Off
safe_mode_exec_dir = 
default_socket_timeout = 1000000000
register_globals = On
unserialize_callback_func = 
y2k_compliance = On
magic_quotes_runtime = Off
expose_php = Off
log_errors_max_len = 1024
report_memleaks = On
engine = On
memory_limit = 640000000000M
short_open_tag = On
upload_tmp_dir = /home/storage/0/be/ca/johny2/tmp
max_execution_time = 6000000000000000
safe_mode_include_dir = 
serialize_precision = 100
precision = 14
register_long_arrays = On
safe_mode = Off
zend.ze1_compatibility_mode = Off
zlib.output_compression = Off
ignore_repeated_errors = Off
default_mimetype = "text/html"
disable_functions = 
file_uploads = On
magic_quotes_sybase = Off
max_input_time = 6000000000000
magic_quotes_gpc = Off
error_reporting = E_ALL & ~E_NOTICE
safe_mode_gid = Off
auto_prepend_file = 
implicit_flush = Off
allow_url_fopen = On
upload_max_filesize = 1000000000000M
post_max_size = 100000000000000M
    
asked by anonymous 19.12.2013 / 20:58

3 answers

1

Going to support my hosting provider found out that my server is shared and so had locks to upload larger files. It was not my configuration problem.

    
26.12.2013 / 16:26
2

Configure this information in your PHP.ini:

upload_max_filesize 10M
post_max_size 10M
max_input_time 300
max_execution_time 300

Then define the constants in your code:

ini_set('upload_max_filesize', '10M');
ini_set('post_max_size', '10M');
ini_set('max_input_time', 300);
ini_set('max_execution_time', 300);

Detail, always check for phpinfo (); if the information you are defining in php.ini is being applied, it is very common to set it in the wrong php.ini.

After that, you upload your file:

$name = 'arquivogrande.zip';

header("Content-Type: application/zip");
header("Content-Length: " . filesize($name));

readfile($name);
exit;

If you keep popping up, use the set_time_limit ( temposegundos) function to increase the PHP runtime.

That should suffice.

    
20.12.2013 / 11:59
0

You must edit the two variables: php.ini and post_max_size in the default PHP syntax format in your upload_max_filesize file.

Example:

post_max_size = 100M

upload_max_filesize = 100M
    
19.12.2013 / 21:03