Gordy
Gordy

Reputation: 101

php seems to be waiting for a response after mysql query has completed

I have a php code snippet:

$sql = "insert into table_new select * from table_old";
mysql_query($sql);
$sql2 = "select * from table_new";
mysql_query($sql2);

The first sql takes some 2-3 hours to complete. I am monitoring it using a mysql console and I can see when it completes, but the PHP script does not continue. It almost seems to be still waiting on the mysql response.

What could have happen here? and how can I mitigate against it?

NOTE: I am aware that I should be using mysqli, but I am in a legacy product and have to use mysql for the remainder.

Upvotes: 3

Views: 723

Answers (1)

Filipe YaBa Polido
Filipe YaBa Polido

Reputation: 1674

You should give a try to GEARMAN. It allows you to have process in background.

Upvotes: 1

Related Questions