標籤:
一.修改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
568char *dest = str;
(gdb) s
569char *data = str;
gdb調試SAPI方式的php