简体   繁体   中英

503 Service Unavailable The server is temporarily busy, try again later

i have using php spreadsheet like this

    <?php 
include 'connection.php';
require '../vendor/autoload.php';

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Reader\Csv;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;

$file_mimes = array('application/octet-stream', 'application/vnd.ms-excel', 'application/x-csv', 'text/x-csv', 'text/csv', 'application/csv', 'application/excel', 'application/vnd.msexcel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');

if(isset($_FILES['filerecon']['name']) && in_array($_FILES['filerecon']['type'], $file_mimes)) {

    $arr_file = explode('.', $_FILES['filerecon']['name']);
    $extension = end($arr_file);
    if('csv' == $extension) {
        $reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv();
    } else {
        $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
    }

    $spreadsheet = $reader->load($_FILES['filerecon']['tmp_name']);

    $sheetData = $spreadsheet->getActiveSheet()->toArray();
    //$i = 1;
    unset($sheetData[0]);



    // $highestRow = $spreadsheet->getActiveSheet()->getHighestRow();

    // echo $highestRow;
    // die;

    $month = $_POST['bulanrecon'];

    foreach ($sheetData as $key => $value) {
        $value = str_replace(["'", '"'], '', $value);
        $ket = 'Anomali';
        if ($value[13] != '') {
            $data = mysqli_fetch_object(mysqli_query($conn, "SELECT COUNT(*) as t FROM new_data_recon WHERE pots_gabungan = '".$value[13]."' AND bulan_input = $month"))->t;
            if ($data > 0) {
                if ($data == 1) {
                    mysqli_query($conn, "UPDATE new_data_recon SET ket_wiw = 'Duplikat (IKR+SETTING)' WHERE pots_gabungan = '".$value[13]."'");
                }
                $ket = 'Duplikat (SETTING)';
            }
            else {
                $ket = 'Clear';
            }
        }

        $sql = "INSERT INTO new_data_recon (id, nomor, regional, witel, datel, sto, order_id, package_name, type_transaksi, jenis_layanan, alpro, ncli, pots, speedy, pots_gabungan, status_resume, status_message, order_date, last_update_status, nama_cust, no_hp, alamat, k_contact, longitude, latitude, area, tanggal, bulan_rec, ket, bulan_input, ket_wiw)
            VALUES ('', '$value[0]', '$value[1]', '$value[2]', '$value[3]', '$value[4]', '$value[5]', '$value[6]', '$value[7]', '$value[8]', '$value[9]', '$value[10]', '$value[11]', '$value[12]', '$value[13]', '$value[14]', '$value[15]', '$value[16]', '$value[17]', '$value[18]', '$value[19]', '$value[20]', '$value[21]', '$value[22]', '$value[23]', '$value[24]', '$value[25]', '$value[26]', '$value[27]', '$month', '$ket')";

        mysqli_query($conn, $sql);
    }

    header("location: https://www.blablabla.id/");
    mysqli_close($conn);
}
?>

i'ts work and doing fine, but just data between 0-16000 rows xlsx, if i import the higher i got this error "503 Service Unavailable The server is temporarily busy, try again later!"

what must i do, can you give me the solved one, and example code?

Please add this code at the top

ini_set("max_execution_time", "-1");
ini_set("memory_limit", "-1");
set_time_limit(0);

And run the script once

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