ItsPawl Posted February 28, 2011 Share Posted February 28, 2011 Im using mysql with a php script in which is start by connection to the database, and when the script has completed at the very end i close the connection. The problem is that the connection keeps closing on its own during execution. Does anyone know how i can increase the time the connection stays alive and where i would go to configure that? Link to comment https://forums.phpfreaks.com/topic/229140-keep-a-connection-alive/ Share on other sites More sharing options...
fenway Posted March 1, 2011 Share Posted March 1, 2011 Somewhere your DB wrapper specifies a timeout. Link to comment https://forums.phpfreaks.com/topic/229140-keep-a-connection-alive/#findComment-1181070 Share on other sites More sharing options...
ItsPawl Posted March 1, 2011 Author Share Posted March 1, 2011 Perhaps you could be more specific? Im not finding any where to set options (using mysql server 5.1 on windows XP with apache). I am pretty new to using mysql. Should say that im not sure that it is acctually getting a time-out. But it seems that way, since putting another connect in the middle of the code fixed the problem temporarily. Also i am using phpMyAdmin, and i can see some database variables but i can not change them from there (timeout is set to 10, and my script runs for 40-45 seconds). Link to comment https://forums.phpfreaks.com/topic/229140-keep-a-connection-alive/#findComment-1181313 Share on other sites More sharing options...
fenway Posted March 1, 2011 Share Posted March 1, 2011 If you're not disconnecting, then your DB wrapper is -- but that's buried somewhere in php, I presume. Link to comment https://forums.phpfreaks.com/topic/229140-keep-a-connection-alive/#findComment-1181567 Share on other sites More sharing options...
Zane Posted March 1, 2011 Share Posted March 1, 2011 mysql_pconnect() maybe? Link to comment https://forums.phpfreaks.com/topic/229140-keep-a-connection-alive/#findComment-1181588 Share on other sites More sharing options...
jcanker Posted June 18, 2011 Share Posted June 18, 2011 max_execution_time is set in php.ini and is 30 seconds by default. If your query is taking longer than that you need to increase that script execution time. But just as important, why are you making users wait that long? Isn't there a way you can break down the info/query so they don't have to go get a cup of coffee before getting a response to the query? Link to comment https://forums.phpfreaks.com/topic/229140-keep-a-connection-alive/#findComment-1231521 Share on other sites More sharing options...
Zane Posted June 18, 2011 Share Posted June 18, 2011 Are you serious? This thread is 1 month and 18 days old. Why are you digging up old questions and attempting to answer them? It doesn't help whatsoever. Unless of course the OP actually logs back in, after all that time and checks. Link to comment https://forums.phpfreaks.com/topic/229140-keep-a-connection-alive/#findComment-1231576 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.