MySQL Query Timeout program in PHP

MySQL Query Timeout program in PHP

am 16.10.2008 03:40:42 von Piyush Kumar

I'm using http://myclient.polarlava.com/ as web query interface for mysql server

Now I want to add "Query Timeout" functionality to it

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

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?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL Query Timeout program in PHP

am 16.10.2008 04:05:52 von dmagick

Piyush Kumar wrote:
> I'm using http://myclient.polarlava.com/ as web query interface for mysql server
>
> Now I want to add "Query Timeout" functionality to it
>
> 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
>
> Please explain how to do that in PHP Thanks!
>
> Similar to what described @ http://bytes.com/forum/thread156058.html

Learn some php and convert the perl script?

What area are you having issues with exactly?

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL Query Timeout program in PHP

am 16.10.2008 04:27:06 von Jack van Zanen

------=_Part_34879_32175420.1224124026996
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Just put the time out in your PHP.INI file

max_execution_time = 30 ; Maximum execution time of each script, in
seconds

2008/10/16 Piyush Kumar

> I'm using http://myclient.polarlava.com/ as web query interface for mysql
> server
>
> Now I want to add "Query Timeout" functionality to it
>
> 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
>
> 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?
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
J.A. van Zanen

------=_Part_34879_32175420.1224124026996--

Re: MySQL Query Timeout program in PHP

am 16.10.2008 05:41:32 von Piyush Kumar

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...

The query runs on mysql server - so I have to kill the PID on server itself...

Thanks
Piyush

On Thu, Oct 16, 2008 at 7:57 AM, Jack van Zanen wrote:
> Just put the time out in your PHP.INI file
>
> max_execution_time = 30 ; Maximum execution time of each script, in
> seconds
>
> 2008/10/16 Piyush Kumar
>>
>> I'm using http://myclient.polarlava.com/ as web query interface for mysql
>> server
>>
>> Now I want to add "Query Timeout" functionality to it
>>
>> 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
>>
>> 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?
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
>
> --
> J.A. van Zanen
>



--
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?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Fwd: MySQL Query Timeout program in PHP

am 16.10.2008 05:41:52 von Piyush Kumar

---------- Forwarded message ----------
From: Piyush Kumar
Date: Thu, Oct 16, 2008 at 9:09 AM
Subject: Re: [PHP-DB] MySQL Query Timeout program in PHP
To: Chris


Hi Chris,

As I mentioned in my query I want to Kill only the query ran by web
client not all queries running on the server.

The perl script kill all queries - which are been running from for
last 120(or any threshold set)

Issues:
How do I get the PID of my last select query ran from the web query
interface..?? Any php function..?

Thanks
Piyush

On Thu, Oct 16, 2008 at 7:35 AM, Chris wrote:
> Piyush Kumar wrote:
>>
>> I'm using http://myclient.polarlava.com/ as web query interface for mysql
>> server
>>
>> Now I want to add "Query Timeout" functionality to it
>>
>> 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
>>
>> Please explain how to do that in PHP Thanks!
>>
>> Similar to what described @ http://bytes.com/forum/thread156058.html
>
> Learn some php and convert the perl script?
>
> What area are you having issues with exactly?
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
>



--
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?



--
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?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL Query Timeout program in PHP

am 16.10.2008 05:57:02 von dmagick

Piyush Kumar wrote:
> Hi Chris,
>
> As I mentioned in my query I want to Kill only the query ran by web
> client not all queries running on the server.
>
> The perl script kill all queries - which are been running from for
> last 120(or any threshold set)
>
> Issues:
> How do I get the PID of my last select query ran from the web query
> interface..?? Any php function..?

No, there isn't.

show processlist;

should give you some info.

It won't give you the whole query, only the start of it.

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL Query Timeout program in PHP

am 16.10.2008 06:56:54 von dmagick

Piyush Kumar wrote:
> show full processlist ; gives me whole query -- but I want some php
> function -- like mysql_info() -- to return the PID of last run query

Please do not email me directly. Always send to the mailing list.

If it's not listed under php.net/mysql somewhere, then it's not
available as a native php function.

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: MySQL Query Timeout program in PHP

am 31.10.2008 08:57:18 von Goltsios Theodore

--------------090208030506090709080203
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit


> 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 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
>>
>>> 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


--------------090208030506090709080203--