简体   繁体   中英

Can't import large file PHP excel

I'm trying to upload 10k+ data in my database (using PHP and Mysql). However the file seems to be too large. If I reduce the size of the file to about 9300 records it works just fine but above that my code seems to fail at the following line $excelReader = PHPExcel_IOFactory::createReaderForFile($tmpfname); I'm including only a snippet of my code (where I think is relevent to this question). I have the upload_max_filesize=124M and post_max_size=124 as well. What could be the problem?

<?php
        $tmpfname = $_FILES['file_save']['tmp_name'];
    echo "0";   
        $excelReader = PHPExcel_IOFactory::createReaderForFile($tmpfname);
echo "1";
        $excelObj = $excelReader->load($tmpfname);
        echo "2";
        $worksheet = $excelObj->getSheet(0);
        echo "3";
        $lastRow = $worksheet->getHighestRow();

    ?>

follow this link : http://www.ozerov.de/bigdump/usage/

  1. Download and unzip bigdump.zip on your PC.
  2. Open bigdump.php in a text editor, adjust the database configuration and dump file encoding.
  3. Drop the old tables on the target database if your dump doesn't contain “DROP TABLE” (use phpMyAdmin).
  4. Create the working directory (eg dump ) on your web server
  5. Upload bigdump.php and the dump files (*.sql or *.gz) via FTP to the working directory (take care of TEXT mode upload for bigdump.php and dump.sql but BINARY mode for dump.gz if uploading from MS Windows).
  6. Run the bigdump.php from your web browser via URL like http://www.yourdomain.com/dump/bigdump.php .
  7. Now you can select the file to be imported from the listing of your working directory. Click “Start import” to start.
  8. BigDump will start every next import session automatically if JavaScript is enabled in your browser.
  9. Relax and wait for the script to finish. Do NOT close the browser window!
  10. IMPORTANT: Remove bigdump.php and your dump files from your web server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM