You are here:  » Search.php not terminating

Support Forum



Search.php not terminating

Submitted by Mark on Tue, 2009-06-09 13:13 in

Hello David.

As you remember we have had a whole group of queries related to speed issues (and in fact the site going down a number of times and the server needing rebooting), but I think we have just found out what is really causing our problems. Hostgator have told us the following:

"It looks like there is a process that is executing but not terminating. {content saved} seems to be running 25 times. Some of those since Jun 8th."

Have you seen this before? What can we do about it?

Thanks,
Mark.

Submitted by support on Tue, 2009-06-09 13:27

Hello Mark,

Normally PHP / MySQL are configured to handle this situation gracefully (in this setup it sounds like MySQL is not returning; as when MySQL returns PHP will then return.

However, this can be handled by setting the PHP ignore_user_abort setting at run-time to ON, so that when a browser (or perhaps more likely a web robot) abandons the connection the process will terminate.

To do this, add the following line of code right at the top of includes/common.php (immediately after the opening PHP tag):

  ini_set("ignore_user_abort",FALSE);

Cheers,
David.

Submitted by Mark on Tue, 2009-06-09 14:30

I'm now getting

Warning: Invalid argument supplied for foreach() in /home/server5/public_html/partnersite-cheapest-bargain.co.uk/search.php on line 162

Warning: Cannot modify header information - headers already sent by (output started at /home/server5/public_html/partnersite-cheapest-bargain.co.uk/search.php:162) in /home/server5/public_html/partnersite-cheapest-bargain.co.uk/html/header.php on line 12

Submitted by support on Tue, 2009-06-09 14:39

Hi Mark,

Could you email me your search.php (as an attachment) and I'll take a look right away for you...

Cheers,
David.

Submitted by Mark on Tue, 2009-06-09 15:11

Hi David.

Submitted by Mark on Tue, 2009-06-09 15:16

Done!

Submitted by Mark on Tue, 2009-06-09 23:19

Hi David - I've installed the new code and done the changes but I see that site {link saved} where the database is, is currently giving a 500 error. What should I do next?

Submitted by support on Wed, 2009-06-10 07:48

Hi Mark,

I notice that it's up and running now - let me know if you still need any help with this...

Cheers,
David.