I am having issues running a PHP script which inserts data to MySQL. The error I get is "504 Gateway Time - out nginx" When the PHP page gets stuck with this timeout 10,102 lines of data have been entered to the database. I'm planning to insert 160,000 lines in one load of the script.
I have made my code more efficient by using a prepared statement for the SQL. The SQL is also set up in this structure:
INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
I have read SO PHP script times out and How to keep a php script from timing out because of a long mysql query
I have tried adding to the start of my code but doesn't seem to make a difference:
set_time_limit(0);
ignore_user_abort(1);
Can anyone show me data to split dataset into chunnks and for each chunk data is inserted?
I will show the section of code that inserts to MySQL below
 // prepare and bind
$stmt = $link->prepare("INSERT INTO MyGuests (`eventID`,`location`,`date`,`barcode`,`runner`,`time`,`Run Points`,`Volunteer Points`,`Gender`, `Gender pos`) VALUES (?,?,?,?,?,?,?,?,?,?)");
$stmt->bind_param("isssssiisi", $eventID,$location,$date,$barcode,$runner,$time,$runpoints,$volpoints,$gender,$genderpos);
// set parameters and execute
for( $x=0; $x < count($array_runner); $x++ ){
    $eventID=null;
    $barcode=$array_barcode[$x];
    $runner=$array_runner[$x];
    $time=$array_time[$x];
    $runpoints=$array_score[$x];
    $volpoints=' ';
    $gender=$array_gender[$x];
    $genderpos=$array_gender_pos[$x];
    $stmt->execute();
}
$stmt->close();
$link->close();
I am new to working with MySQL and am looking for some guidance with this problem.



max_execution_timeapplied to the CLI