Frank Vilea
Frank Vilea

Reputation: 8487

PHP/MySQL request counter

In PHP/MySQL, is there a way to show how many requests are being performed when loading the different web pages? I would like to know how often PHP accesses the database and if possible how long it takes.

Upvotes: 0

Views: 388

Answers (2)

Andrin von Rechenberg
Andrin von Rechenberg

Reputation: 647

If you expect a lot of traffic on your website you can also use an external service like www.prodeagle.com which allows you to monitor and count anything you want without having to access your mysql database.

Upvotes: 0

zerkms
zerkms

Reputation: 254926

There is no built-in functions to do that, but you can implement your own counter.

Just wrap your query function with something like:

function perform_query($sql, $get_cnt = false)
{
    static $cnt = 0;

    if ($get_cnt) return $cnt;

    $cnt++;

    return mysql_query($sql);
}

Upvotes: 2

Related Questions