A way to use transaction and prepared statement to speed-up bulk INSERTs :
<?php
// ...
$insert = $pdo->prepare('INSERT INTO table (c1, c2, c3) VALUES (?, ?, ?)');
$bulk = 3_000; // To adjust according to your data/system
$rows = 0;
$pdo->beginTransaction();
while ($entry = fgetcsv($fp)) {
$insert->execute($entry);
if (++$rows % $bulk === 0) {
$pdo->commit();
$pdo->beginTransaction();
}
}
if ($pdo->inTransaction()) { // Remaining rows insertion
$pdo->commit();
}