2011-04-21 82 views
0

有没有办法从PHP直接获取MySQL等待超时?从PHP获取MySQL等待超时

+4

问题不明确 – ariefbayu 2011-04-21 07:36:26

+0

您的意思是! – Gowri 2011-04-21 07:36:45

+0

他想知道你是否可以从数据库中找到它的超时时间(如PHP中的最大执行时间)是否来自PHP。 @ user718480你可能需要对数据库使用某种查询。 – ohmusama 2011-04-21 07:39:51

回答

7

只是做一个正常的mysql查询。

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

在PHP中,它看起来像这样。

// 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']; 
+1

我对此进行了验证。 – ohmusama 2011-04-21 07:46:35

+0

是的,我知道这一点。所以我不能没有SQL查询这个信息? – anon 2011-04-21 08:07:27

+0

您的答案已改进更新如果出现任何问题,请随时回滚 – 2011-04-21 08:14:28