Important question! Since the hosting allocated no more than 128MB of RAM, I can not handle large Excel files.
Actually, I need to convert any Excel file to CSV. But with very large amounts of data, the PHP script lacks RAM.
The main rule: memory_limit is installed only in php.ini and there is no other way to install it.
Actually here is the code:
<?php header("Content-Type: text/plain; charset=utf-8"); ini_set("display_errors", "On"); error_reporting(E_ALL); set_time_limit(0); require_once "./class/PHPExcel.php"; $source = $_GET['source']; // large.csv = 42M or large.xlsx = 15M // Установка метода всё равно не снимает использование RAM-машины $method = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp; $arguments = ["cacheMemorySize" => "1024M"]; PHPExcel_Settings::setCacheStorageMethod($method, $arguments); $type = PHPExcel_IOFactory::identify($source); $reader = PHPExcel_IOFactory::createReader($type); // Результат после выполнения : $reader->load("large.csv"); // FATAL ERROR: Allowed memory size of 134217728 bytes exhausted (tried to // allocate 32 bytes) in [path_to_class]/PHPExcel/Cell.php on line 550 // // Результат после выполнения : $reader->load("large.xlsx"); // FATAL ERROR: Allowed memory size of 134217728 bytes exhausted (tried to // allocate 218235205 bytes) in /home/max/localhost/html/class/PHPExcel/Reader/Excel2007.php // on line 327 /*$excel = */ $reader->load($source); ?> And here is the actual QUESTION (s):
How to install instead of using RAM - the specified folder? (eg ./temp/)
Is it possible to do this?