Re: MySQL Query Timeout program in PHP

From: Date: Fri, 31 Oct 2008 07:57:18 +0000
Subject: Re: MySQL Query Timeout program in PHP
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-45569@lists.php.net to get a copy of this message
Man- when the query is fired through the web interface- it rans on mysql server.... max_execution_time - wont' help evn I stop apache itself...
Yes it will. Apache will be instructed to stop execution of any script by the mod_php module (assuming you are using mod_php). But mysql process probably won't stop running (not 100% sure for that) although php script has timed out.
The query runs on mysql server - so I have to kill the PID on server itself...
In order to do this you will need (in the unix world) to have rights to kill mysql processes. That means that you must become either root or the mysql user which is not that simple since everything that apache runs is usually running as the apache or the www user who can't kill those processes (at least if he can't su exec). I will have to note here that this is a bad practice of doing things...
Thanks Piyush On Thu, Oct 16, 2008 at 7:57 AM, Jack van Zanen <jack@vanzanen.com> wrote:
Just put the time out in your PHP.INI file
max_execution_time = 30     ; Maximum execution time of each script, in
seconds
    
This is probably a solution although you will have to know what to expect if you query a table with 3M records. It will be slow and that can't change. Try using "LIMIT" when sending queries to stop mass data retrieval.
2008/10/16 Piyush Kumar <piykumar@gmail.com>
    
I'm using http://myclient.polarlava.com/ as web query interface for mysql
server Now I want to add "Query Timeout" functionality to it
      
Every apache process has a timeout limit you can leave the user wait for a page a lifetime.
For that I need to get the PID for last ran mysql query and then using kill PID - I can kill the process on MySQL server
      Sorry but I still can't see why.
Please explain how to do that in PHP Thanks! Similar to what described @ http://bytes.com/forum/thread156058.html -- Thanks & Regards, -Piyush Mo.: 091-9910904233 Mail: piykumar@gmail.com Web: http://piyush.me/ -In a world without fences, limits, boundaries and walls, Who needs Windows and Gates?
      
Although some think that limits are wrong I still have walls around my house. Windows are not so bad sometimes everything has its use. Besides everyone needs to be annoyed from time to time.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
      
-- J.A. van Zanen
    
-- Thodoris

« previous php.db (#45569) next »