一.修改php-fpm.conf文件
/usr/local/php/etc/php-fpm.conf
pm.max_children = 1 #只产生一个进程,便于追踪
二.得到进行服务的进程号
[[email protected] etc]# ps aux|grep php-fpm
root 15212 0.0 0.2 190148 3316 ? Ss 17:39 0:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
nobody 15224 0.0 0.3 190672 4228 ? S 17:40 0:00 php-fpm: pool www
root 15322 0.0 0.0 103252 804 pts/0 S+ 17:58 0:00 grep php-fpm
15212 master process 是监控进程,不用管它
15224 work process 工作进程,使用它
#gdb -p 15224
(gdb) b /home/php-5.3.25/ext/standard/url.c:566 //主要调用php内核对query_string参数进行decode处理
Breakpoint 1 at 0x722ec4: file /home/php-5.3.25/ext/standard/url.c, line 566.
(gdb) c
Continuing.
这时再开一个终端,
执行 curl ‘http://10.10.9.154:9002/test.php?age=12345‘
之前的终端,使用s命令,进入函数,进行调试
(gdb) b /home/php-5.3.25/ext/standard/url.c:566
Breakpoint 1 at 0x722ec4: file /home/php-5.3.25/ext/standard/url.c, line 566.
(gdb) c
Continuing.
Breakpoint 1, php_url_decode (str=0x2e3be18 "age", len=3) at /home/php-5.3.25/ext/standard/url.c:568
568 char *dest = str;
(gdb) s
569 char *data = str;