Hey guys. I'm running a script that looks for a specific term in a pdf file. Well, actually I'm reading the pdf file as a txt file and look for the term there. The script processes over 20k files. But, unexpectedly, the script breaks after it hits a file that is over 50mb long. It stops.
What could the reason be? Here's an excerpt of the script:
// Proceed if file exists
if(file_exists($sourcePath)){
echo "file exists\n";
if(filesize($sourcePath) > 0){
echo "filesize is greater than 0\n";
$pdfFile = fopen($sourcePath,"rb");
$data = fread($pdfFile, filesize($sourcePath));
fclose($pdfFile);
// Search for string
if(stripos($data,$searchFor)){
echo "Success. encrypt found\r\n";
fwrite($errorFileHandler,"Success. encrypt found\r\n");
}else{
.....
}
...
...
What could be the problem?