0

I have Apache 2.2 PHP 5.3 MySQL 5.5 application. A form on page1.php accepts user input. Values are passed to page2.php using GET. PHP script on page2.php runs MySQL query and shows results. Depending on the user input parameters query may run from 3 to 900 seconds.

In my tests results from any query that runs < 300 sec are shown OK. Longer running queries are completed OK on the server (I see CPU load goes from 90% to 0% after lets say 500 sec) but browser is not showing result and keeps showing in the status bar "Transferring data from my.host.org ..."

At this time when I am trying to open any page of my application in new instance of the same browser (Firefox) it says "Connecting..." on the tab header and "Waiting for my.host.org ..." in the status bar. Opening any page of my application in other browser (IE) at this time goes OK.

Below are setting I have changed/set so far but they did not help. Any ideas would be helpful. Thank you.

apache2.conf:
Timeout 300  -> 1800

php.ini:
user_ini.cache_ttl = 300  -> 1800
max_execution_time = 30  -> 1800
default_socket_timeout = 60  -> 1800
mysql.connect_timeout = 60 -> 1800

page2.php: 
ignore_user_abort(1);
user1293929
  • 51
  • 2
  • 5
  • 1
    Why is your query running for so long, and if it's unavoidable then why are you trying to do so interactively? – Ignacio Vazquez-Abrams Aug 12 '12 at 23:10
  • Are you running php as fcgi? There are certain settings you may have to change. – Krynble Aug 12 '12 at 23:15
  • I am running PHP as Apache module on Ubuntu 12.04. I have a research database and several researchers that use my application occasionally. Application creates many temporary tables, re-aggregates data, etc. Probably it is possible to redesign and optimize the application to cut time but that would be a major project we cannot afford now. It is not uncommon in research or statistical applications to have long running time. I do not think that long running time should be a reason for moving away from GIU. – user1293929 Aug 13 '12 at 02:57

1 Answers1

0

Considering this is a long running query, do you really need to run it in the browser window?

You should consider using a Cron job and redirecting the output to an e-mail address, PHP processes running in the CLI have, by default, unlimited execution time.

As my last piece of help, if you're running PHP as (F)CGI you may have to change the CGI setting to wait for output from the PHP process a bit longer.

Krynble
  • 614
  • 7
  • 18