PHP超时错误500 [关闭]

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

You can set the timelimt in the script. YOu can set it to unlimited by using this:

set_time_limit ( 0 )

Think in this code:

<?php
   $configuration = array(
        'mysql-user'    => 'username',
        'mysql-password'    => 'password',
        'mysql-host'    => '127.0.0.1',
        'mysql-database'    => 'database',
   );

   $mysqli = mysqli_connect($configuration["mysql-host"], $configuration["mysql-user"], $configuration["mysql-password"], $configuration["mysql-database"]) or die("Error " . mysqli_error($link));
   $mysqli->set_charset("utf8");

and in your 2nd code you have an error

ERROR:

for($i=0;i<count($sql_prod_s_saida_inARR);$i++)

CORRECT:

for( $i = 0; $i < count($sql_prod_s_saida_inARR); $i++ )

One suggestion, if you have 110k of records, made that in parts, for exemple 10k at time.

The main reason aswell is that after each insert the table will reindex. You can stop this with transactions if i'm correct, this will increase your speed with over a 100 times :D