PHP 500 Expiration Error

I have an array with SQL instructions 'TRUNCATE and INSERT', that assembly is retrieved from the txt file.

The procedures truncate and insert are made on 6 tables, the problem is that one of the tables will receive 110,000 records.

I did some tests:

1st http://pastebin.com/egbnbfVa

Phrase ... Error: MySQL server has gone away

Error number 2006 ...

2nd http://pastebin.com/tfF7ZaVd

This ... the 500 error


i think your script is too long to execute. check the php log and change execution_time if you cant optimise your script