Wedge
Public area => The Pub => Off-topic => Topic started by: nend on May 29th, 2012, 06:11 AM
-
I was wondering is there any way in PHP to set a time limit on a PHP function. Say if the function is not done in a certain amount of time the function execution is cancelled and the function returns nothing.
What I want to do is start a heavy query and if the query doesn't finish in a certain amount of time have the query stop and the function exited.
-
No, there isn't.
-
That is sad, :sob:, you would think there would be a way to do this by now.
-
That concept only really works if the setup is properly geared for asynchronous behaviour, something PHP isn't.
That said, the MySQLi driver (note, not the ext/mysql driver that SMF and Wedge rely on) can actually set a timeout with the mysqli_options() function but you can't intermix them.
That might be enough reason to convince us to move to ext/mysqli though!
-
If it makes you feel better... :P
-
I said *might*. It's not really a *huge* change from my perspective, MySQLi can be used mostly as a drop-in replacement over MySQL's original driver, but I'm not sure how widely deployed MySQLi is.
-
The ext is installed on my cheap account. :niark:
-
Yeah mysqli is pretty much everywhere
-
Hrm, in which case it might be worth making the leap to make use of such extras.