Skip to content

xurenlu/slowphp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

    slowphp --- A simple php module to log slow queries.

1.
    cp slowphp.so to your php extensions directory;
2.
    add this to your php.ini:

<code>
extension=slowphp.so
[slowphp]
#执行时间超过多少了就开启记录;
slowphp.long_query_time=2
#日志写到什么地方;
slowphp.long_query_log = "/tmp/php_long_query.log"
#多大的概率,指的是多少分之一(写100就是百分之一)
slowphp.long_query_log_probability=100
#当下面这个文件存在时,不管任何条件,一定会开启记录;
slowphp.long_query_lock_file="/tmp/php_long_query.lock"
</code>


3:
    enjoy the simple awesome module!



Help:
    
    1.I want to view execute-time of each file.What should I do?

        As you specificed in the php.ini,For example,you wrote this:
            <code>
            slowphp.long_query_lock_file="/tmp/php_long_query.lock"
            </code>
        you just touch file /tmp/php_long_query.lock simply:
        <code>
        $touch /tmp/php_long_query.lock
        </code>
        Now,He will log execute-time for you. When you finished your
        debugs,you need delete the file /tmp/php_long_query.lock

    2.How should I specific a slowphp.long_query_log_probability?
        
        When you wrote 100,slowphp log the execute-time every 100 times (not
        exactly,you see,we mean "probability".

        For site much more busy, a huge number should be given.

About

a php module to log slow query.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published