PHPIO

Cross request trace for PHP,like google's dapper,twitter's zipkin.

This project is maintained by hemon

PHPIO

Cross request trace for PHP,like google's dapper,twitter's zipkin.
It's base on AOP-PHP extension. PHPIO is focus on trace IO operation, such like Curl, MySQL, Memcache, Redis, APC.
It's easily write your own Hooker monitor function/class operation in 10 line code.

原理与实现(PPT)

Install aop extension

pecl install aop-beta
[aop]  
extension=aop.so 

if coredump ?
1. change you aop extension version (the pecl version is stable than github)
2. rebuild php

get phpio

download tarball

wget https://github.com/hemon/phpio/tarball/master -O phpio.tar.gz  
tar xvf phpio.tar.gz  

or git clone

git clone https://hemon@github.com/hemon/phpio

prepend phpio.php

php.ini

auto_prepend_file = /path/to/phpio/phpio.php  

php-fpm

php_admin_value[auto_prepend_file] = /path/to/phpio/phpio.php

start profile

run you php programs with param XDEBUG_PROFILE=1

$_REQUEST['XDEBUG_PROFILE']=1  
$_COOKIE['XDEBUG_PROFILE']=1  
$_SERVER['XDEBUG_PROFILE']=1  

for example : http://www.example.com/index.php?XDEBUG_PROFILE=1

recommand firfox addon easy-xdebug, it can auto append user defined cookie param in request(default is XDEBUG_PROFILE=1):

in php-cli mode, use export command to set param for $_SERVER

export XDEBUG_PROFILE=1

view profile

make phpio/www is accessible:

http://localhost/phpio/www/