0

Is there a way to get mysql wait timeout directly from php?

1
  • He wants to know if you can find out from the DB how long its timeout (like max execution time in PHP) is from PHP. @user718480 you will likely need to use some sort of query to the db. Commented Apr 21, 2011 at 7:39

1 Answer 1

7

Just make a normal mysql query.

mysql> show variables where Variable_name='wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 28800 |
+---------------+-------+
1 row in set (0.07 sec)

In PHP it'd look something like this.

// it's been a while to there might be typos
$res = mysql_query("show variables where Variable_name='wait_timeout'");
$arr = mysql_fetch_assoc($res);
echo $arr['Variable_name'];
echo $arr['Value'];
Sign up to request clarification or add additional context in comments.

2 Comments

Yeah, I know about that. So I can't get this info without sql-query?
Your answer is improved updated Feel free to rollback if anything gone wrong

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.