2011-04-21 84 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