php打印出“终止”,终端没有任何错误

I have this script that is supposed to read a big csv file and insert the contents into database(mysql). I am running the script from terminal ie php index.php however after some time the script prints out Terminated and stops running without any reasonable error. I have added all these to the script but still can't get it to finish exacution: set_time_limit(0); ignore_user_abort() ; ini_set('memory_limit','5120M'); Below is a snipet of the code.NB I have just picked a small bit of it.

<?php
set_time_limit(0);
ignore_user_abort() ;
ini_set('memory_limit','5120M');
echo ini_get("memory_limit")."
";
$conn = new mysqli("dbase1", "apps", "t3ck", "transactional");
$files = array("/home/username/mycsv.csv");
foreach($files as $file){
    echo "----------------------------------------------------------------------------------$file--------------------------------------------
";
    $rows = array_map('str_getcsv', file($file));
    $csv = array();
    $array = explode(".",$file);
    $name = $array[0];
    //$service = getserviceId($name);

    foreach ($rows as $row) {
        $conn->query("INSERT INTO transactions (foreign_key, model, created, modified) VALUES (NULL, NULL, now(), now());");
        $count = $conn->insert_id;
        echo "TRX id: $count 
";
        $no= $row[0];
        $net = "FDO";
        $query = "insert ignore into text_gf services_id,no,net,sub_date,transactions_id,created,last_delivery_date) VALUES(118,$no,$net,now(),$count,now(),now())";
        $res =$conn->query($query);

        if($res) {
            echo "$msisdn saved  
";
        } else {
            print_r($conn->error);
            die();
        }
    }
unlink($file);
}

Am sorry for this stupid question. Someone had added a cronjob which was running after every 5 minute that was killing all php processes. ie */5 * * * * pkill php .

You call die(); and here your process stops without any message.

else {
        print_r($conn->error);
        die();
}

As I guess the "Terminated" message is caused by the script passing max execution time you can try to up the execution time by setting it in PHP.

ini_set('max_execution_time', 600); //600 seconds = 10 minutes