'I want to process 32,000 lines of excel. But it stops around 3,000. What makes this possible?

It stops for about 3,000 lines and then stops. It processes Excel with less data. But as soon as it becomes 3-4mbyte the excel will stop. Current excel has 32,000 rows and 12 columns. With lots of data. If I overwrite this data with less content the script will run! What could be the problem? The hosting? Memory limit is -1, script runtime is 6000.

if (isset($argv[1]))
{
    $Filepath = "../uploads/".$argv[1];
}
elseif (isset($_GET['File']))
{
    $Filepath = "../uploads/".$_GET['File'];
}
else
{
    if (php_sapi_name() == 'cli')
    {
        echo 'Please specify filename as the first argument';
    }
    else
    {
        echo 'Please specify filename as File';
    }
    exit;
}
require('php-excel-reader/excel_reader2.php');
require('SpreadsheetReader.php');
date_default_timezone_set('UTC');
$StartMem = memory_get_usage();
try
{
    $Spreadsheet = new SpreadsheetReader($Filepath);
    $BaseMem = memory_get_usage();
    $Sheets = $Spreadsheet -> Sheets();
    echo "<table border='1' width='100%'>";
    foreach ($Sheets as $Index => $Name)
    {
        $Time = microtime(true);
        $Spreadsheet -> ChangeSheet($Index);
        foreach ($Spreadsheet as $Key => $Row)
        {
            $count = $Key;
            if($Row)
            {
                if($Key == 1)
                {
                echo "<tr style='background-color: red;'>";
                 print_r("<td>" . $Key  . "</td>");
                echo "</tr>";
                }
                if($Key > 1)
                {
                echo $Key . "<br />";
                }
            }
            else
            {
                var_dump($Row);
            }
            $CurrentMem = memory_get_usage();
        }
    }
    echo "</table>";
    echo $count ."mem:". $CurrentMem." bytes" ;
}
catch (Exception $E)
{
    echo $E -> getMessage();
}
unlink($Filepath);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source