Requesting to download the file in the middle of the run

Asked

Viewed 71 times

0

I have a small problem, I have an execution in PHP that generates an average of 34 thousand Insert’s in Mysql, this is done via stored Procedure.

But when I run the same execution is around 5 minutes running and suddenly asks to download the file XPTO.php.

Even so, the execution at the bank continues.

What can I do to solve the problem?

Utilise:

  • Zend Server - 7.0.0
  • Mysql - 5.5.40
  • PHP - 5.4.24
  • Any error is returned ? Where is the code ?

  • does not generate any error simply to request the download of the file, so I understood the browser simply for execution. but the execution in the bank processes until the end

  • We can assume that XPTO.php is some third party library and you have already taken proper precautions regarding the time limit?

  • no worse than it is not the file that does the whole procedure and yes we take care with respect to the time limit

  • 1

    Show us the code :)

  • I really can’t do this, first of all because it’s something from a very large company. second is something around 4500 lines, but runs until the end only I have this calculation procedure on a basis of 3600000 records generating only 35000 records and making the same Insert in another table

  • Since you cannot share the code, try sharing the contents of the XPTO.php file (which would be the equivalent of the error) and/or the response HTTP headers (which would be to see why the browser decided to download the file instead of showing on the screen).

Show 2 more comments

2 answers

1


Guys I figured out how to solve the issue.

In Zend Server we have this configuration in XML his pattern:

<Timeouts connectionTimeout="60" requestTimeout="120" />

I ended up trading for:

<Timeouts connectionTimeout="60" requestTimeout="1500" />

So solve my problem.

I’m grateful for everyone who tried to help.

  • I think your way of solving a mistake can create worse ones...

  • the routine was validated several times and I arrived at this solution because it only occurred in the development computers. so I made a diff with the production server coming up with this solution

  • You’re updating 3600000 records for 5 minutes - that’s the problem. What will happen if your DB doubles in size?

  • we have a permission to leave the whole business rule in the database because they are kept by ibm the application servers are more simplorious

0

In this case, I think increasing Timeout time is not a good option. If the problem is the INSERT number, instead of making 34,000 you can make one just like this:

 INSERT INTO example
    (example_id, name, value, other_value)
 VALUES
   (100, 'Name 1', 'Value 1', 'Other 1'),
   (101, 'Name 2', 'Value 2', 'Other 2'),
   (102, 'Name 3', 'Value 3', 'Other 3'),
   (103, 'Name 4', 'Value 4', 'Other 4');

Also, need to know why you need to do 34,000 INSERT... If and to solve a DUMP type problem, you can use SQL directly without using PHP.

To respond in Otto’s comment, saying that he uses store_procedure, that:

 for ($test=0; $test<10; $test++)
 {
 $str = ""; 
     for ($w=0; $w < 3400; $w++)
     {
        $str .= "(".$w.",'Name1','Totpo','Name2'),\n";
    }
     $str .= "(".$w.",'Name1','Totpo','Name2');";

    $query_insert = "
    INSERT INTO EXEMPLE
    (champ1,champ2,champ3,champ4)
    VALUES ".$str;
    //echo $query_insert;
    $result = sql_query($db_so36,$query_insert);
 }

then, 34,000 INSERT, it only takes 0.271 sec !

  • the Inserts are generated via store Process all execution is database ... or better all rule of business is database

Browser other questions tagged

You are not signed in. Login or sign up in order to post.