phpcsvpaf

Import paf using php


I’m working with the royal mail PAF database in csv format (approx 29 million lines), and need to split the data into sql server using php.

Can anyone recommend the best method for this to prevent timeout?

Here is a sample of the data: https://gist.github.com/anonymous/8278066


Solution

  • To disable the script execution time limit, start your script off with this:

    set_time_limit(0);
    

    Another problem you will likely run into is a memory limit. Make sure you are reading your file line-by-line or in chunks, rather than the whole file at once. You can do this with fgets().