~ 1GB 크기의 탭으로 구분 된 파일을 구문 분석하려고합니다. 내가 스크립트를 실행매우 큰 파일의 내용을 읽고 구문 분석합니다.
내가 얻을 :
이Fatal error: Allowed memory size of 1895825408 bytes exhausted (tried to allocate 1029206974 bytes) ...
순간에 내 스크립트가 그냥 :
$file = file_get_contents('allCountries.txt') ;
$file = str_replace(array("\r\n", "\t"), array("[NEW*LINE]", "[tAbul*Ator]"), $file) ;
나는 -1로는 php.ini의 메모리 제한을 설정 한 나 제공 :
Fatal error: Out of memory (allocated 1029963776) (tried to allocate 1029206974 bytes)
부분적으로 파일을 열고 적은 메모리가 사용되도록 다음 부분에 이동에 어쨌든 거기 한 때?
파일을 한 줄씩 처리하지 않는 이유는 무엇입니까? –