set_time_limit + mysql

From: -----> sylvain (nospam_at_nospam.com)
Date: 12/30/03


Date: Tue, 30 Dec 2003 18:08:07 +0000

hello,

here comes a script which behaves differently with php 4.2.0 + mysql
3.23.49 and php 4.3.3 (or 4.2.3) + mysql 4.0.15.

the oldest version gives the "good" result (with a tiny problem : no
"Fatal error : Maximum execution time of 1 second exceeded in..."
appears... ) : the execution time of the script does not exceed 1 second.

the newest one does not care of the set_time_limit(1) function and the
script is normally executed.

--> why? how can I get the "good" result with php 4.3.3 + mysql 4.0.15?

thanks,

sylvain

please, try this script (do not forget to set host, user and password) :

<?php

set_time_limit(1);

$t_start = array_sum(explode(' ', microtime()));

$link = mysql_connect("localhost", "", "");
if ( !is_resource($link) ){ exit(mysql_error()); }

$query = "SELECT BENCHMARK(10000000, ENCODE('hello', 'world')) ;";
@mysql_query($query, $link);
if ( mysql_error() != "" ){ exit(mysql_error()); }

@mysql_close($link);

$exec_time = array_sum(explode(' ', microtime())) - $t_start;
echo "Execution time is $exec_time seconds.";

?>



Relevant Pages

  • Re: [PHP] PHP console script vs C/C++/C#
    ... My script is taking a longer time to execute than I want. ... I prefer to write in PHP because that is what I know best. ... This is why I am thinking about rewriting my whole script in a C language. ... Perhaps there are different methods I could be using to speed up execution. ...
    (php.general)
  • Re: Script stops running during while()
    ... that processes records returned by a MySQL query. ... The HTML page continues trying to load the page but the php has stopped running and eventually I get a timeout. ... I have a new PC and had to re-install php, Apache and MySQL ... The script executed perfectly on my old PC ...
    (comp.lang.php)
  • Re: How to Add a Feeback Form
    ... I saw nothing in that script that indicates where the form is e-mailed to so ... Greg Maxey/Word MVP ... PHP or not. ... have the support available yet. ...
    (microsoft.public.frontpage.programming)
  • How best to show PHP source? (was: One page, multiple submit buttons)
    ... script to add to the top of a PHP script to enable showing its ... Maybe anybody submitting their own PHP code for critique here ... Anything posted to a newsgroup is a "snapshot" of what the ... there ought to be a FAQ for this ...
    (comp.lang.php)
  • [Full-Disclosure] [waraxe-2004-SA#031 - Multiple vulnerabilities in e107 version 0.615]
    ... mysql must be version 4.x with enabled UNION ... script - must be kept in secret, when possible, or it ... php error messages, ... Potential attacker can use xss to steal the cookies, ...
    (Full-Disclosure)