php-general Digest 28 Jun 2009 09:13:39 -0000 Issue 6199

Topics (messages 294672 through 294691):

mysql_query blocking
        294672 by: Daniel Kolbo
        294673 by: Ashley Sheridan
        294674 by: Daniel Kolbo
        294675 by: Daniel Kolbo
        294676 by: Ashley Sheridan
        294677 by: Daniel Kolbo
        294679 by: Tom Worster
        294681 by: Bastien Koert
        294682 by: Bastien Koert
        294683 by: Bastien Koert
        294684 by: Daniel Kolbo
        294685 by: Daniel Kolbo
        294686 by: Daniel Kolbo
        294690 by: Bastien Koert
        294691 by: Lester Caine

why is this shell_exec() failing to execute my shell to create a symlink?
        294678 by: Govinda
        294687 by: Jonathan Tapicer

symLink Test also failing.  (then is it a permissions issue?  - also see my 
previous post about shell_exec failing)
        294680 by: Govinda

Re: PHP 5.2.9 Apache 2.2.11 outputs php code on Vista
        294688 by: ioannes.btinternet.com
        294689 by: ioannes.btinternet.com

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Hello,

When a MySQL table is locked a php call of mysql_query() that requires
that table will hang as the request blocks at the MySQL server until the
table is unlocked.  Is there a way to stop a mysql_query from hanging
(by setting a time limit)?

The php.ini directive max_execution_time does not help b/c:
"Note: The set_time_limit() function and the configuration directive
max_execution_time only affect the execution time of the script itself.
Any time spent on activity that happens outside the execution of the
script such as system calls using system(), stream operations, database
queries, etc. is not included when determining the maximum time that the
script has been running."

The my.ini directive table_lock_wait_timeout does not work either b/c
from MySQL:
"This variable currently is unused. "
(I am using mysql v5.1)

I do not want to bluntly stop this from the apache level.

How does one place a time limit on the execution of mysql_query()?

Thanks for your help,
dK


--- End Message ---
--- Begin Message ---
On Sat, 2009-06-27 at 15:15 -0400, Daniel Kolbo wrote:
> Hello,
> 
> When a MySQL table is locked a php call of mysql_query() that requires
> that table will hang as the request blocks at the MySQL server until the
> table is unlocked.  Is there a way to stop a mysql_query from hanging
> (by setting a time limit)?
> 
> The php.ini directive max_execution_time does not help b/c:
> "Note: The set_time_limit() function and the configuration directive
> max_execution_time only affect the execution time of the script itself.
> Any time spent on activity that happens outside the execution of the
> script such as system calls using system(), stream operations, database
> queries, etc. is not included when determining the maximum time that the
> script has been running."
> 
> The my.ini directive table_lock_wait_timeout does not work either b/c
> from MySQL:
> "This variable currently is unused. "
> (I am using mysql v5.1)
> 
> I do not want to bluntly stop this from the apache level.
> 
> How does one place a time limit on the execution of mysql_query()?
> 
> Thanks for your help,
> dK
> 
> 
It depends on what type of table you have, MyISAM blocks at table level
for instance, while InnoDB locks at row level.

Thanks
Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---

Daniel Kolbo wrote:
> Hello,
> 
> When a MySQL table is locked a php call of mysql_query() that requires
> that table will hang as the request blocks at the MySQL server until the
> table is unlocked.  Is there a way to stop a mysql_query from hanging
> (by setting a time limit)?
> 
> The php.ini directive max_execution_time does not help b/c:
> "Note: The set_time_limit() function and the configuration directive
> max_execution_time only affect the execution time of the script itself.
> Any time spent on activity that happens outside the execution of the
> script such as system calls using system(), stream operations, database
> queries, etc. is not included when determining the maximum time that the
> script has been running."
> 
> The my.ini directive table_lock_wait_timeout does not work either b/c
> from MySQL:
> "This variable currently is unused. "
> (I am using mysql v5.1)
> 
> I do not want to bluntly stop this from the apache level.
> 
> How does one place a time limit on the execution of mysql_query()?
> 
> Thanks for your help,
> dK
> 
> 

Even the apache TimeOut directive does not seem to work in this situation.

Any help would be appreciated.

Thanks,
dK

--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
> On Sat, 2009-06-27 at 15:15 -0400, Daniel Kolbo wrote:
>> Hello,
>>
>> When a MySQL table is locked a php call of mysql_query() that requires
>> that table will hang as the request blocks at the MySQL server until the
>> table is unlocked.  Is there a way to stop a mysql_query from hanging
>> (by setting a time limit)?
>>
>> The php.ini directive max_execution_time does not help b/c:
>> "Note: The set_time_limit() function and the configuration directive
>> max_execution_time only affect the execution time of the script itself.
>> Any time spent on activity that happens outside the execution of the
>> script such as system calls using system(), stream operations, database
>> queries, etc. is not included when determining the maximum time that the
>> script has been running."
>>
>> The my.ini directive table_lock_wait_timeout does not work either b/c
>> from MySQL:
>> "This variable currently is unused. "
>> (I am using mysql v5.1)
>>
>> I do not want to bluntly stop this from the apache level.
>>
>> How does one place a time limit on the execution of mysql_query()?
>>
>> Thanks for your help,
>> dK
>>
>>
> It depends on what type of table you have, MyISAM blocks at table level
> for instance, while InnoDB locks at row level.
> 
> Thanks
> Ash
> www.ashleysheridan.co.uk
> 
> 

I'm using InnoDB.
But either way how do you place a time limit on mysql_query()?
Thanks,
dK

--- End Message ---
--- Begin Message ---
On Sat, 2009-06-27 at 16:03 -0400, Daniel Kolbo wrote:
> Ashley Sheridan wrote:
> > On Sat, 2009-06-27 at 15:15 -0400, Daniel Kolbo wrote:
> >> Hello,
> >>
> >> When a MySQL table is locked a php call of mysql_query() that requires
> >> that table will hang as the request blocks at the MySQL server until the
> >> table is unlocked.  Is there a way to stop a mysql_query from hanging
> >> (by setting a time limit)?
> >>
> >> The php.ini directive max_execution_time does not help b/c:
> >> "Note: The set_time_limit() function and the configuration directive
> >> max_execution_time only affect the execution time of the script itself.
> >> Any time spent on activity that happens outside the execution of the
> >> script such as system calls using system(), stream operations, database
> >> queries, etc. is not included when determining the maximum time that the
> >> script has been running."
> >>
> >> The my.ini directive table_lock_wait_timeout does not work either b/c
> >> from MySQL:
> >> "This variable currently is unused. "
> >> (I am using mysql v5.1)
> >>
> >> I do not want to bluntly stop this from the apache level.
> >>
> >> How does one place a time limit on the execution of mysql_query()?
> >>
> >> Thanks for your help,
> >> dK
> >>
> >>
> > It depends on what type of table you have, MyISAM blocks at table level
> > for instance, while InnoDB locks at row level.
> > 
> > Thanks
> > Ash
> > www.ashleysheridan.co.uk
> > 
> > 
> 
> I'm using InnoDB.
> But either way how do you place a time limit on mysql_query()?
> Thanks,
> dK
> 
I've not seen this done before, but it should only be row locking if
you're using InnoDB. What queries are you running that are affecting a
script that badly?

Thanks
Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
> On Sat, 2009-06-27 at 16:03 -0400, Daniel Kolbo wrote:
>> Ashley Sheridan wrote:
>>> On Sat, 2009-06-27 at 15:15 -0400, Daniel Kolbo wrote:
>>>> Hello,
>>>>
>>>> When a MySQL table is locked a php call of mysql_query() that requires
>>>> that table will hang as the request blocks at the MySQL server until the
>>>> table is unlocked.  Is there a way to stop a mysql_query from hanging
>>>> (by setting a time limit)?
>>>>
>>>> The php.ini directive max_execution_time does not help b/c:
>>>> "Note: The set_time_limit() function and the configuration directive
>>>> max_execution_time only affect the execution time of the script itself.
>>>> Any time spent on activity that happens outside the execution of the
>>>> script such as system calls using system(), stream operations, database
>>>> queries, etc. is not included when determining the maximum time that the
>>>> script has been running."
>>>>
>>>> The my.ini directive table_lock_wait_timeout does not work either b/c
>>>> from MySQL:
>>>> "This variable currently is unused. "
>>>> (I am using mysql v5.1)
>>>>
>>>> I do not want to bluntly stop this from the apache level.
>>>>
>>>> How does one place a time limit on the execution of mysql_query()?
>>>>
>>>> Thanks for your help,
>>>> dK
>>>>
>>>>
>>> It depends on what type of table you have, MyISAM blocks at table level
>>> for instance, while InnoDB locks at row level.
>>>
>>> Thanks
>>> Ash
>>> www.ashleysheridan.co.uk
>>>
>>>
>> I'm using InnoDB.
>> But either way how do you place a time limit on mysql_query()?
>> Thanks,
>> dK
>>
> I've not seen this done before, but it should only be row locking if
> you're using InnoDB. What queries are you running that are affecting a
> script that badly?
> 
> Thanks
> Ash
> www.ashleysheridan.co.uk
> 
> 
I issue a 'lock tables tablename write' and do some work.  This is to be
expected.  I want a way that to stop mysql_query() from just waiting for
 the mysql server.
`

--- End Message ---
--- Begin Message ---
On 6/27/09 3:15 PM, "Daniel Kolbo" <[email protected]> wrote:

> When a MySQL table is locked a php call of mysql_query() that requires
> that table will hang as the request blocks at the MySQL server until the
> table is unlocked.  Is there a way to stop a mysql_query from hanging
> (by setting a time limit)?

would it be possible to test for presence of the lock before issuing the
query that would block? if so, you could check the lock periodically until
your time limit is up. would achieve you you're looking for?



--- End Message ---
--- Begin Message ---
Why issue/do a lock at all? Shouldn't need a large lock at read

bastien

On Saturday, June 27, 2009, Daniel Kolbo <[email protected]> wrote:
> Ashley Sheridan wrote:
>> On Sat, 2009-06-27 at 16:03 -0400, Daniel Kolbo wrote:
>>> Ashley Sheridan wrote:
>>>> On Sat, 2009-06-27 at 15:15 -0400, Daniel Kolbo wrote:
>>>>> Hello,
>>>>>
>>>>> When a MySQL table is locked a php call of mysql_query() that requires
>>>>> that table will hang as the request blocks at the MySQL server until the
>>>>> table is unlocked.  Is there a way to stop a mysql_query from hanging
>>>>> (by setting a time limit)?
>>>>>
>>>>> The php.ini directive max_execution_time does not help b/c:
>>>>> "Note: The set_time_limit() function and the configuration directive
>>>>> max_execution_time only affect the execution time of the script itself.
>>>>> Any time spent on activity that happens outside the execution of the
>>>>> script such as system calls using system(), stream operations, database
>>>>> queries, etc. is not included when determining the maximum time that the
>>>>> script has been running."
>>>>>
>>>>> The my.ini directive table_lock_wait_timeout does not work either b/c
>>>>> from MySQL:
>>>>> "This variable currently is unused. "
>>>>> (I am using mysql v5.1)
>>>>>
>>>>> I do not want to bluntly stop this from the apache level.
>>>>>
>>>>> How does one place a time limit on the execution of mysql_query()?
>>>>>
>>>>> Thanks for your help,
>>>>> dK
>>>>>
>>>>>
>>>> It depends on what type of table you have, MyISAM blocks at table level
>>>> for instance, while InnoDB locks at row level.
>>>>
>>>> Thanks
>>>> Ash
>>>> www.ashleysheridan.co.uk <http://www.ashleysheridan.co.uk>
>>>>
>>>>
>>> I'm using InnoDB.
>>> But either way how do you place a time limit on mysql_query()?
>>> Thanks,
>>> dK
>>>
>> I've not seen this done before, but it should only be row locking if
>> you're using InnoDB. What queries are you running that are affecting a
>> script that badly?
>>
>> Thanks
>> Ash
>> www.ashleysheridan.co.uk <http://www.ashleysheridan.co.uk>
>>
>>
> I issue a 'lock tables tablename write' and do some work.  This is to be
> expected.  I want a way that to stop mysql_query() from just waiting for
>  the mysql server.
> `
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 

Bastien

Cat, the other other white meat

--- End Message ---
--- Begin Message ---
On Saturday, June 27, 2009, Bastien Koert <[email protected]> wrote:
> Why issue/do a lock at all? Shouldn't need a large lock at read
>
> bastien
>
> On Saturday, June 27, 2009, Daniel Kolbo


 <[email protected]> wrote

>> Ashley Sheridan wrote:
>>> On Sat, 2009-06-27 at 16:03 -0400, Daniel Kolbo wrote:
>>>> Ashley Sheridan wrote:
>>>>> On Sat, 2009-06-27 at 15:15 -0400, Daniel Kolbo wrote:
>>>>>> Hello,
>>>>>>
>>>>>> When a MySQL table is locked a php call of mysql_query() that requires
>>>>>> that table will hang as the request blocks at the MySQL server until the
>>>>>> table is unlocked.  Is there a way to stop a mysql_query from hanging
>>>>>> (by setting a time limit)?
>>>>>>
>>>>>> The php.ini directive max_execution_time does not help b/c:
>>>>>> "Note: The set_time_limit() function and the configuration directive
>>>>>> max_execution_time only affect the execution time of the script itself.
>>>>>> Any time spent on activity that happens outside the execution of the
>>>>>> script such as system calls using system(), stream operations, database
>>>>>> queries, etc. is not included when determining the maximum time that the
>>>>>> script has been running."
>>>>>>
>>>>>> The my.ini directive table_lock_wait_timeout does not work either b/c
>>>>>> from MySQL:
>>>>>> "This variable currently is unused. "
>>>>>> (I am using mysql v5.1)
>>>>>>
>>>>>> I do not want to bluntly stop this from the apache level.
>>>>>>
>>>>>> How does one place a time limit on the execution of mysql_query()?
>>>>>>
>>>>>> Thanks for your help,
>>>>>> dK
>>>>>>
>>>>>>
>>>>> It depends on what type of table you have, MyISAM blocks at table level
>>>>> for instance, while InnoDB locks at row level.
>>>>>
>>>>> Thanks
>>>>> Ash
>>>>> www.ashleysheridan.co.uk <http://www.ashleysheridan.co.uk> <http://www.ashleysheridan.co.uk>
>>>>>
>>>>>
>>>> I'm using InnoDB.
>>>> But either way how do you place a time limit on mysql_query()?
>>>> Thanks,
>>>> dK
>>>>
>>> I've not seen this done before, but it should only be row locking if
>>> you're using InnoDB. What queries are you running that are affecting a
>>> script that badly?
>>>
>>> Thanks
>>> Ash
>>> www.ashleysheridan.co.uk <http://www.ashleysheridan.co.uk> <http://www.ashleysheridan.co.uk>
>>>
>>>
>> I issue a 'lock tables tablename write' and do some work.  This is to be
>> expected.  I want a way that to stop mysql_query() from just waiting for
>>  the mysql server.
>> `
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> --
>
> Bastien
>
> Cat, the other other white meat
>

-- 

Bastien

Cat, the other other white meat

--- End Message ---
--- Begin Message ---


Bastien

Sent from my iPod

On Jun 27, 2009, at 4:13 PM, Daniel Kolbo <[email protected]> wrote:

Ashley Sheridan wrote:
On Sat, 2009-06-27 at 16:03 -0400, Daniel Kolbo wrote:
Ashley Sheridan wrote:
On Sat, 2009-06-27 at 15:15 -0400, Daniel Kolbo wrote:
Hello,

When a MySQL table is locked a php call of mysql_query() that requires that table will hang as the request blocks at the MySQL server until the table is unlocked. Is there a way to stop a mysql_query from hanging
(by setting a time limit)?

The php.ini directive max_execution_time does not help b/c:
"Note: The set_time_limit() function and the configuration directive max_execution_time only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using system(), stream operations, database queries, etc. is not included when determining the maximum time that the
script has been running."

The my.ini directive table_lock_wait_timeout does not work either b/c
from MySQL:
"This variable currently is unused. "
(I am using mysql v5.1)

I do not want to bluntly stop this from the apache level.

How does one place a time limit on the execution of mysql_query()?

Thanks for your help,
dK


It depends on what type of table you have, MyISAM blocks at table level
for instance, while InnoDB locks at row level.

Thanks
Ash
www.ashleysheridan.co.uk


I'm using InnoDB.
But either way how do you place a time limit on mysql_query()?
Thanks,
dK

I've not seen this done before, but it should only be row locking if
you're using InnoDB. What queries are you running that are affecting a
script that badly?

Thanks
Ash
www.ashleysheridan.co.uk


I issue a 'lock tables tablename write' and do some work. This is to be expected. I want a way that to stop mysql_query() from just waiting for
the mysql server.
`

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




Further thought, do you have indexes on the table?


Bastien

--- End Message ---
--- Begin Message ---
Tom Worster wrote:
> On 6/27/09 3:15 PM, "Daniel Kolbo" <[email protected]> wrote:
> 
>> When a MySQL table is locked a php call of mysql_query() that requires
>> that table will hang as the request blocks at the MySQL server until the
>> table is unlocked.  Is there a way to stop a mysql_query from hanging
>> (by setting a time limit)?
> 
> would it be possible to test for presence of the lock before issuing the
> query that would block? if so, you could check the lock periodically until
> your time limit is up. would achieve you you're looking for?
> 
> 
> 
it would still be possible that after checking but before issuing the
query the table's could be locked - albeit a much smaller chance.

Thanks for the input,
dK

--- End Message ---
--- Begin Message ---
Bastien Koert wrote:
> Why issue/do a lock at all? Shouldn't need a large lock at read
> 
> bastien
> 
> On Saturday, June 27, 2009, Daniel Kolbo <[email protected]> wrote:
>> Ashley Sheridan wrote:
>>> On Sat, 2009-06-27 at 16:03 -0400, Daniel Kolbo wrote:
>>>> Ashley Sheridan wrote:
>>>>> On Sat, 2009-06-27 at 15:15 -0400, Daniel Kolbo wrote:
>>>>>> Hello,
>>>>>>
>>>>>> When a MySQL table is locked a php call of mysql_query() that requires
>>>>>> that table will hang as the request blocks at the MySQL server until the
>>>>>> table is unlocked.  Is there a way to stop a mysql_query from hanging
>>>>>> (by setting a time limit)?
>>>>>>
>>>>>> The php.ini directive max_execution_time does not help b/c:
>>>>>> "Note: The set_time_limit() function and the configuration directive
>>>>>> max_execution_time only affect the execution time of the script itself.
>>>>>> Any time spent on activity that happens outside the execution of the
>>>>>> script such as system calls using system(), stream operations, database
>>>>>> queries, etc. is not included when determining the maximum time that the
>>>>>> script has been running."
>>>>>>
>>>>>> The my.ini directive table_lock_wait_timeout does not work either b/c
>>>>>> from MySQL:
>>>>>> "This variable currently is unused. "
>>>>>> (I am using mysql v5.1)
>>>>>>
>>>>>> I do not want to bluntly stop this from the apache level.
>>>>>>
>>>>>> How does one place a time limit on the execution of mysql_query()?
>>>>>>
>>>>>> Thanks for your help,
>>>>>> dK
>>>>>>
>>>>>>
>>>>> It depends on what type of table you have, MyISAM blocks at table level
>>>>> for instance, while InnoDB locks at row level.
>>>>>
>>>>> Thanks
>>>>> Ash
>>>>> www.ashleysheridan.co.uk <http://www.ashleysheridan.co.uk>
>>>>>
>>>>>
>>>> I'm using InnoDB.
>>>> But either way how do you place a time limit on mysql_query()?
>>>> Thanks,
>>>> dK
>>>>
>>> I've not seen this done before, but it should only be row locking if
>>> you're using InnoDB. What queries are you running that are affecting a
>>> script that badly?
>>>
>>> Thanks
>>> Ash
>>> www.ashleysheridan.co.uk <http://www.ashleysheridan.co.uk>
>>>
>>>
>> I issue a 'lock tables tablename write' and do some work.  This is to be
>> expected.  I want a way that to stop mysql_query() from just waiting for
>>  the mysql server.
>> `
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 
a different user (user who is updating) would be doing the lock.

thanks,
dK

--- End Message ---
--- Begin Message ---
Phpster wrote:
> 
> 
> Bastien
> 
> Sent from my iPod
> 
> On Jun 27, 2009, at 4:13 PM, Daniel Kolbo <[email protected]> wrote:
> 
>> Ashley Sheridan wrote:
>>> On Sat, 2009-06-27 at 16:03 -0400, Daniel Kolbo wrote:
>>>> Ashley Sheridan wrote:
>>>>> On Sat, 2009-06-27 at 15:15 -0400, Daniel Kolbo wrote:
>>>>>> Hello,
>>>>>>
>>>>>> When a MySQL table is locked a php call of mysql_query() that
>>>>>> requires
>>>>>> that table will hang as the request blocks at the MySQL server
>>>>>> until the
>>>>>> table is unlocked.  Is there a way to stop a mysql_query from hanging
>>>>>> (by setting a time limit)?
>>>>>>
>>>>>> The php.ini directive max_execution_time does not help b/c:
>>>>>> "Note: The set_time_limit() function and the configuration directive
>>>>>> max_execution_time only affect the execution time of the script
>>>>>> itself.
>>>>>> Any time spent on activity that happens outside the execution of the
>>>>>> script such as system calls using system(), stream operations,
>>>>>> database
>>>>>> queries, etc. is not included when determining the maximum time
>>>>>> that the
>>>>>> script has been running."
>>>>>>
>>>>>> The my.ini directive table_lock_wait_timeout does not work either b/c
>>>>>> from MySQL:
>>>>>> "This variable currently is unused. "
>>>>>> (I am using mysql v5.1)
>>>>>>
>>>>>> I do not want to bluntly stop this from the apache level.
>>>>>>
>>>>>> How does one place a time limit on the execution of mysql_query()?
>>>>>>
>>>>>> Thanks for your help,
>>>>>> dK
>>>>>>
>>>>>>
>>>>> It depends on what type of table you have, MyISAM blocks at table
>>>>> level
>>>>> for instance, while InnoDB locks at row level.
>>>>>
>>>>> Thanks
>>>>> Ash
>>>>> www.ashleysheridan.co.uk
>>>>>
>>>>>
>>>> I'm using InnoDB.
>>>> But either way how do you place a time limit on mysql_query()?
>>>> Thanks,
>>>> dK
>>>>
>>> I've not seen this done before, but it should only be row locking if
>>> you're using InnoDB. What queries are you running that are affecting a
>>> script that badly?
>>>
>>> Thanks
>>> Ash
>>> www.ashleysheridan.co.uk
>>>
>>>
>> I issue a 'lock tables tablename write' and do some work.  This is to be
>> expected.  I want a way that to stop mysql_query() from just waiting for
>> the mysql server.
>> `
>>
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
> 
> 
> 
> Further thought, do you have indexes on the table?
> 
> 
> Bastien
> 
Yes.
The question is not about MySQL efficiency - i'll leave that to the
MySQL email group.
This question is about putting in place PHP safe guards.

Thanks,
dK

--- End Message ---
--- Begin Message ---


On Jun 27, 2009, at 7:17 PM, Daniel Kolbo <[email protected]> wrote:

Phpster wrote:


Bastien

Sent from my iPod

On Jun 27, 2009, at 4:13 PM, Daniel Kolbo <[email protected]> wrote:

Ashley Sheridan wrote:
On Sat, 2009-06-27 at 16:03 -0400, Daniel Kolbo wrote:
Ashley Sheridan wrote:
On Sat, 2009-06-27 at 15:15 -0400, Daniel Kolbo wrote:
Hello,

When a MySQL table is locked a php call of mysql_query() that
requires
that table will hang as the request blocks at the MySQL server
until the
table is unlocked. Is there a way to stop a mysql_query from hanging
(by setting a time limit)?

The php.ini directive max_execution_time does not help b/c:
"Note: The set_time_limit() function and the configuration directive
max_execution_time only affect the execution time of the script
itself.
Any time spent on activity that happens outside the execution of the
script such as system calls using system(), stream operations,
database
queries, etc. is not included when determining the maximum time
that the
script has been running."

The my.ini directive table_lock_wait_timeout does not work either b/c
from MySQL:
"This variable currently is unused. "
(I am using mysql v5.1)

I do not want to bluntly stop this from the apache level.

How does one place a time limit on the execution of mysql_query ()?

Thanks for your help,
dK


It depends on what type of table you have, MyISAM blocks at table
level
for instance, while InnoDB locks at row level.

Thanks
Ash
www.ashleysheridan.co.uk


I'm using InnoDB.
But either way how do you place a time limit on mysql_query()?
Thanks,
dK

I've not seen this done before, but it should only be row locking if you're using InnoDB. What queries are you running that are affecting a
script that badly?

Thanks
Ash
www.ashleysheridan.co.uk


I issue a 'lock tables tablename write' and do some work. This is to be expected. I want a way that to stop mysql_query() from just waiting for
the mysql server.
`

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




Further thought, do you have indexes on the table?


Bastien

Yes.
The question is not about MySQL efficiency - i'll leave that to the
MySQL email group.
This question is about putting in place PHP safe guards.

Thanks,
dK


So it's a concurrency question. There are a couple of schools of thought here:

Flag the record on select before the update to 'lock' it to a specific user. Any other user would get a readonly version of the data ( perhaps with a notice indicating another user has the lock )

Another common option is to accept both changes into a queue and then deciding who's data shall be the final version.

This would add a ton of complexity fir very little gain. IMHO the first option is better as you could build functionality to track the record request and notify the second user when that data has been committed and the 'lock' flag turned 'off'.

Bastien


--- End Message ---
--- Begin Message ---
Daniel Kolbo wrote:
Hello,

When a MySQL table is locked a php call of mysql_query() that requires
that table will hang as the request blocks at the MySQL server until the
table is unlocked.  Is there a way to stop a mysql_query from hanging
(by setting a time limit)?

Daniel
I can understand you asking the question here, but I suspect that the answer may come better from a list who has people who are more expert in MySQL?

Personally - with Firebird - this is not a problem that ever arises since 'locking' is not something one would normally do and has only appeared IN Firebird because people 'expect' that is how a database works. Even if using it would actually be wrong :) The problem is that the database is the problem rather than PHP, hence the questions about which type of tables you are using in MySQL.

From my personal experience, it's the way that you are using the database that may be wrong if it relies on 'locking' to achieve something that is not properly managed IN the database. Any database can provide 'locking', if that is really required, by additional flagging in the database - if the database itself does not provide the function properly. Such as setting an 'edit' flag on a record showing who is changing it, which can then be used to advise that fact to other users.

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
this code:

<?php

        $testOutput = shell_exec("ls");

        $where2cd2='testDir/';
        $firstCMD="cd $where2cd2";
         $firstOutput = shell_exec("$firstCMD");
        // $firstOutput = shell_exec('cd testDir/');
        $testOutput2 = shell_exec("ls");

        $secondCMD='ln -s amex_cid.gif myccGOV.gif';
        $secondOutput = shell_exec("$secondCMD");
        
        echo "testOutput:<br><pre>$testOutput</pre>";
echo "testOutput2:<br><pre>$testOutput2</pre><br>firstCMD= $firstCMD<hr>"; echo "firstOutput:<br><pre>$firstOutput</pre><br>secondCMD= $secondCMD<hr>"; echo "secondOutput:<br><pre>$secondOutput</pre><br>thirdCMD= $thirdCMD<hr>";
        
?>

is not producing the symlink that I think it should. (?!?) (neither in the dir/ where this script lives, nor in the testDir/ where I am actually trying to create it, on the fly.
Server is not in safe mode.


------------
Govinda
[email protected]

--- End Message ---
--- Begin Message ---
Make sure that:

- The user executing the script (apache I presume) has execute
permissions on ls and ln binaries.
- The user executing the script has write persmissions on the
directory you are trying to write, and read permissions where you do
ls.
- This will probably help: put the full binary path for ls and ln, it
depends on your OS, but probably they are: /bin/ls and /bin/ln

If that doesn't help, can you show us the output?

Jonathan

On Sat, Jun 27, 2009 at 5:46 PM, Govinda<[email protected]> wrote:
> this code:
>
> <?php
>
>        $testOutput = shell_exec("ls");
>
>        $where2cd2='testDir/';
>        $firstCMD="cd $where2cd2";
>         $firstOutput = shell_exec("$firstCMD");
>        // $firstOutput = shell_exec('cd testDir/');
>        $testOutput2 = shell_exec("ls");
>
>        $secondCMD='ln -s amex_cid.gif myccGOV.gif';
>        $secondOutput = shell_exec("$secondCMD");
>
>        echo "testOutput:<br><pre>$testOutput</pre>";
>        echo
> "testOutput2:<br><pre>$testOutput2</pre><br>firstCMD=$firstCMD<hr>";
>        echo
> "firstOutput:<br><pre>$firstOutput</pre><br>secondCMD=$secondCMD<hr>";
>        echo
> "secondOutput:<br><pre>$secondOutput</pre><br>thirdCMD=$thirdCMD<hr>";
>
> ?>
>
> is not producing the symlink that I think it should.  (?!?)  (neither in the
> dir/ where this script lives, nor in the testDir/ where I am actually trying
> to create it, on the fly.
> Server is not in safe mode.
>
>
> ------------
> Govinda
> [email protected]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
and in this test, $symLinkTest seems to be returning false, every time.

        $symLinkTarget='testDir/amex_cid.gif';
        $SymLinkNew='testDir/myccGOV.gif';
        $symLinkTest=symlink($symLinkTarget, $SymLinkNew);

        echo "symLinkTest=";
        echo var_dump($symLinkTest);

--

returns:
symLinkTest=bool(false)

--

the amex_cid.gif' file is definitely there in the testDir/ dir.

??

------------
Govinda
[email protected]


--- End Message ---
--- Begin Message --- Solved: In Windows 'Explorer' in Vista, set User permissions for the htdocs - go to htdocs folder within the Apache folders, right click, Properties, Security, Edit, select your name as User, allow Full Control, Modify etc. Now open the files you created like test.php or index1.html and save them again. Then they will be accessible like http://localhost/test.php etc. Whereas without this they will be 'file not found'.

Even if there is only one User in Windows and it is also the Administrator, you need to be recognised as Administrator for the action being done, normal log on to Windows will be as User only.

I got to the above solution when I noticed the http://localhost/index.html showed Apache working, in the browser using the index.html that comes with the installation, but index1.html saved in the same folder did not appear in Windows Explorer and also was 'page not found' in the browser, even though it saved OK and was visible and loadable in the html editor. php now also works with Apache, I think I was missing from httpd.conf within <IfModule mime_module> </IfModule>:

   AddHandler application/x-httpd-php .php
   AddHandler application/x-httpd-php-source .phps


John

[email protected] wrote:
I still have the strange thing of saving a file in htdocs within the Apache folders (on Vista, you need to right click on Notepad from Start and Run as Administrator), but then not seeing it in Windows Explorer - must be something to do with UAC. But main problem is getting php to work with Apache. Please let me know if there is anywhere else I should look. I took the time to read the php installation notes carefully and the Apache notes (which seemed to be mostly about meeting someone in a computer fair to check their fingerprint, I joke), but to no avail.

Does anyone have a working, full, step-by-step set of instructions for Vista, PHP 5.2.9 Apache 2.2.11 ?

Thanks,

John


Original post [ed]

I have a working Apache 2.2.11 server and php 5.2.9 installed.

APACHE CONFIGURATION

Files are in: C:/Program Files/Apache Software Foundation/Apache2.2/
As per installation instructions, Apache httpd.conf is amended to add at the end of the LoadModule lines (though not between any tags):

   LoadModule php5_module "C:/PHP/php5apache2_2.dll"

   PHPIniDir "C:/PHP"

And at the end of the file:

   AddModule mod_php5.c

(Would this be .conf, not .c?). , (per php notes 'Installing as an Apache module'). On clicking Start Apache http server, this gives "Invalid command 'AddModule' perhaps misspelled or defined by a module not included in server configuration." The PHP Installation guide says to add this at the end of the AddModule section. There is no AddModule in the default http.conf of Apache 2.2.11. So for now have commented it out.

Between <IfModule mime_module> and </IfModule>, I have added:

   AddType application/x-httpd-php .php


PHP CONFIGURATION

The php.ini file is in C:/PHP.

php.ini has been amended as follows:
doc_root = "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs"

WINDOWS CONFIGURATION

I have added ;C:/PHP to the end of the string for Environment Variables.

I have re-booted and re-started.  I am testing this file:

C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php

which has
<?
print("test");
?>

and this outputs as code rather than as 'test' or it does not output at all.

When I start the Apache http server, I get:

httpd.exe: Could not reliably determine the server's fully qualified domain name
, using 10.0.0.4 for ServerName
(OS 10048)Only one usage of each socket address (protocol/network address/port)
is normally permitted.  : make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

My ISP has a dynamic IP address system, what do I use for ServerName? Do I need a static address or registered web site name to run on home computer?

Apache httpd.conf has:
# ServerName gives the name and port that the server uses to identify itself. # This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName

Any idea what might be wrong with the php code showing?

Thanks,

John





--- End Message ---
--- Begin Message ---
...though phpinfo seems to work fine without this handler.

[email protected] wrote:
php now also works with Apache, I think I was missing from httpd.conf within <IfModule mime_module> </IfModule>:

   AddHandler application/x-httpd-php .php
   AddHandler application/x-httpd-php-source .phps


John



--- End Message ---

Reply via email to