Answer the question
In order to leave comments, you need to log in
Working with large files for preg_match_all?
$base = file_get_contents("https://site.ru/base.php"); // base.php используется как txt файл.
$text = "Поиск";
preg_match_all('/\b'.$text.'\:(.*)/i', $base, $otvet);
Answer the question
In order to leave comments, you need to log in
look at the file size. let it be 8 meters
file_get_contents(" https://site.ru/base.php "); - 8+
$base = 16m allocated
for the pre-match is also an overhead.
so try to give the scripts 4 file sizes. available memory
file_get_contents reads into memory. No memory - no cookies, look in the error logs... Try to read in the fopen-fread loop not the whole file, but in pieces of 64k, for example. The only problem is not to lose the possible "tail", for example, by throwing the last 5 characters from the previous reading to the beginning of the next one.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question