centos - php's execution time and memory limit -
i using centos 5 server. got error while attempting download 1gb of file server server that
maximum execution time exceeded.
i opened php.ini file, written there
max_execution_time = 30 ; maximum execution time of each script, in seconds max_input_time = 60 ; maximum amount of time each script may spend parsing request data memory_limit = 128m ; maximum amount of memory script may consume
in last line written maximum amount of memory script may consume
mean actually? not download more per script execution or memory taken script executed (sharing types) searched not got answer of this. please if 1 can tell me mean , how can able download approx 1gb of data through script other server using php.
edit
code using download file server using curl
$username = "user"; $password = "pwd"; $url = "http://domain.com/feeds/"; global $ch; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_userpwd, "$username:$password"); curl_setopt($ch, curlopt_httpauth, curlauth_any); curl_setopt($ch, curlopt_ssl_verifypeer, false); curl_setopt($ch, curlopt_followlocation, true); curl_setopt($ch, curlopt_httpheader, array("content-type: text/xml")); curl_setopt($ch, curlopt_unrestricted_auth, 1); $output = curl_exec($ch); $r = time()-(24*60*60); $dateit = date("ymd", $r); $file8 = "abc".$dateit.".tbz"; $file3 = "abc".$dateit.".tbz.md5"; $file5 = "xyz".$dateit.".tbz"; $file4 = "xyz".$dateit.".tbz.md5"; $file7 = "lmn".$dateit.".tbz"; $file2 = "lmn".$dateit.".tbz.md5"; $file6 = "pqr".$dateit.".tbz"; $file1 = "pqr".$dateit.".tbz.md5"; $arr = array($file1, $file2, $file3, $file4, $file5, $file6); for($i=0;$i<=4;$i++) { $url = "http://domain.com/feeds/current-data/".$arr[$i]; curl_setopt($ch, curlopt_url, $url); $fp = fopen("adminarea/folder1/".$arr[$i], 'w+'); curl_setopt($ch, curlopt_file, $fp); curl_exec ($ch); } fclose($fp); curl_close($ch);
any idea link or view highly appreciated.
the memory_limit
max amount of data script can have loaded into memory @ given time. means if try , read entire contents of 1gb file variable, yes, you'll run problems.
on other hand, if download file directly disk (rather trying read contents in script), can streamed through memory piece piece, , wouldn't run memory limitations.
you manually read file chunk chunk using things fread()
keep going on memory limit @ given time.
Comments
Post a Comment