<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post//</link>
<title><![CDATA[[实践OK]centos安装php版本对应的扩展xdebug链接以及因Xdebug版本太高WinCacheGrind无法解析只得采用kcachegrind并安装用kcachegrind系统分析,后缀变为callgrind。支持swoole的Xdebug版本。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Tue, 25 Dec 2018 06:45:19 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	支持swoole的Xdebug版本：https://github.com/mabu233/sdebug支持swoole的Xdebug扩展<br/><br/><textarea name="code" class="php" rows="15" cols="100">
看ELK里的failed (104: Connection reset by peer) 这种错误，
php规定时间没正常执行完，返回给网关Nginx的数据为空导致。

试试含有Xdebug的镜像运行PHP压力测试时看PHP到底卡哪儿了：
registry.qr.XXXX.net/irdc_irdcops/php-strace:7.1.6

一）Xdebug生成运行的时间文件在：/data/logs/xdebug

二）sz下来后用kcachegrind打开分析,kcachegrind下载：(PHP7版本wincachedgrind报错，无法显示。)
https://phoenixnap.dl.sourceforge.net/project/precompiledbin/kcachegrind.zip
https://sourceforge.net/projects/qcachegrind-fixed-source/postdownload&nbsp;&nbsp;AddTime:2022.06.01

加上Xdebug，Tps会下降严重可以忽略，是能看到其执行大体时间占比。
</textarea><br/><br/>MacBook下面需要自己编译：<br/>https://tekkie.ro/computer-setup/how-to-install-kcachegrind-qcachegrind-on-mac-osx/<br/>https://blog.josephscott.org/2013/07/03/qcachegrind-kcachegrind-on-mac-os-x/<br/><br/>xdebug是和PHP的版本对应起来的，这一步很重要，如下：<br/><a href="https://xdebug.org/wizard.php" target="_blank">https://xdebug.org/wizard.php</a><br/>centos安装php版本对应的扩展xdebug链接:<br/><textarea name="code" class="php" rows="15" cols="100">
/usr/local/php7/bin/phpize
./configure --with-php-config=/usr/local/php7/bin/php-config
make &amp;&amp; make install
安装时注意：./configure后面得加 --with-php-config=/usr/local/php7/bin/php-config,否则会报：
checking Check for supported PHP versions... configure: error: not supported. Need a PHP version &gt;= 7.0.0 and &lt; 7.4.0 (found 5.6.38)
</textarea><br/><br/><br/><br/>使用图形分析工具wincachedgrind分析生成的文件<br/><br/>下载地址：http://sourceforge.net/projects/wincachegrind/files/<br/><br/>centos安装php扩展xdebug安装以及用kcachegrind系统分析<br/>Download:<br/>https://phoenixnap.dl.sourceforge.net/project/precompiledbin/kcachegrind.zip<br/>kali linux:<br/>Install kcachegrind Using apt<br/>Update apt database with apt using the following command.<br/><br/>sudo apt update<br/>After updating apt database, We can install kcachegrind using apt by running the following command:<br/><br/>sudo apt -y install kcachegrind<br/><br/>来自：https://installati.one/kalilinux/kcachegrind/<br/><br/>百度网盘。<br/>实践发现：<br/>找开kcachegrind文件时要以它的后缀结尾，直接贴进去地址就成。<br/>之前的后缀是cache,现在修改一下它这个后缀即可：<br/>xdebug.profiler_output_name=&quot;cachegrind.out.%H.%u.%s&quot;<br/>修改为：<br/>xdebug.profiler_output_name=&quot;callgrind.out.%H.%u.%s&quot;&nbsp;&nbsp; #kcachegrind在Win下面只认这个前缀的才能打开分析，直接拖cachegrind.out*进去是打不开的。<br/>解决kcachegrind在Win下面只认这个前缀的才能打开分析批量xdebug的文件重命名的办法：<br/><textarea name="code" class="php" rows="15" cols="100">
for i in $(ls -1 *) ;do echo mv $i $&#123;i/cachegrind/callgrind&#125;;done&#124;sh
</textarea><br/>shell下的文本替换，Shell字符串替换学习---武明瑶：<a href="https://jackxiang.com/post/9922/" target="_blank">https://jackxiang.com/post/9922/</a><br/><textarea name="code" class="php" rows="15" cols="100">
[Xdebug]
 zend_extension=&quot;/usr/local/php/ext/xdebug.so&quot;
 xdebug.profiler_enable = on
 xdebug.default_enable = on
 xdebug.trace_output_dir=&quot;/data/logs/xdebug&quot;
 xdebug.trace_output_name = trace.%c.%p
 xdebug.profiler_output_dir=&quot;/data/logs/xdebug&quot;
 xdebug.profiler_output_name=&quot;cachegrind.out.%H.%u.%s&quot;&nbsp;&nbsp;#删这行
 xdebug.profiler_output_name=&quot;callgrind.out.%H.%u.%s&quot;&nbsp;&nbsp;

 xdebug.dump_once=On
 xdebug.dump_globals=On
 xdebug.dump_undefined=On

 xdebug.dump.REQUEST=*
 xdebug.dump.SERVER=REQUEST_METHOD,REQUEST_URI,HTTP_USER_AGENT

 xdebug.show_exception_trace=On
 xdebug.show_local_vars=1
 xdebug.var_display_max_depth=6

 xdebug.max_nesting_level=50
</textarea><br/><br/>mkdir -p /data/logs/xdebug<br/>chown -R www /data/logs/xdebug<br/>chmod -R 755 /data/logs/xdebug<br/><br/>打成RPM包的SPEC文件：<br/><textarea name="code" class="php" rows="15" cols="100">
cat xdebug-kphp71-2.7.2.el7.x86_64.spec 
%define builddate&nbsp;&nbsp;&nbsp;&nbsp;%(date +%y%m%d%H%M%%S)
%define _php_fpm&nbsp;&nbsp;&nbsp;&nbsp; kphp
%define php_dir&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/usr/local/php
%define php_bin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%&#123;php_dir&#125;/bin
%define php_extdir&nbsp;&nbsp; /usr/local/php/ext
%define php_version&nbsp;&nbsp;7.1.6

Name:&nbsp;&nbsp;&nbsp;&nbsp;xdebug-php71
Version: 2.7.2
Release: %&#123;builddate&#125;%&#123;?dist&#125;
Summary: xdebug

Group: Development/Languages
License: PHP
URL: https://github.com/xdebug/xdebug-src/releases/tag/1.8.11-stable
BuildRoot: %&#123;_topdir&#125;/BUILDROOT
BuildRequires: gcc, make, autoconf, automake, libtool, %&#123;_php_fpm&#125; = %&#123;php_version&#125;
Requires: %&#123;_php_fpm&#125; = %&#123;php_version&#125;

%description
The phpxdebug extension provides an API for communicating with the Redis key-value store.

%prep
tar zxf $RPM_SOURCE_DIR/xdebug-2.7.2.tgz -C $RPM_BUILD_DIR

%build
cd&nbsp;&nbsp;$RPM_BUILD_DIR/xdebug-2.7.2
%&#123;php_bin&#125;/phpize
./configure --with-php-config=%&#123;php_bin&#125;/php-config
make
make test

%install
rm -Rf $RPM_BUILD_ROOT
cd&nbsp;&nbsp;$RPM_BUILD_DIR/xdebug-2.7.2
make install INSTALL_ROOT=$RPM_BUILD_ROOT
mkdir -p %&#123;buildroot&#125;%&#123;php_extdir&#125;
mv %&#123;buildroot&#125;%&#123;php_dir&#125;/lib/php/extensions/no-debug-non*/xdebug.so %&#123;buildroot&#125;%&#123;php_extdir&#125;

%post
mkdir -p /data/logs/xdebug &amp;&amp; chown -R www.www /data/logs/xdebug &amp;&amp; chmod -R 755 /data/logs/xdebug
&nbsp;&nbsp;&nbsp;&nbsp;cat &gt; %&#123;php_dir&#125;/etc/php.d/xdebug.ini &lt;&lt; EOF
[Xdebug]
 zend_extension=&quot;/usr/local/php/ext/xdebug.so&quot;
 xdebug.profiler_enable = on
 xdebug.default_enable = on
 xdebug.trace_output_dir=&quot;/data/logs/xdebug&quot;
 xdebug.trace_output_name = trace.%c.%p
 xdebug.profiler_output_dir=&quot;/data/logs/xdebug&quot;
 xdebug.profiler_output_name=&quot;callgrind.out.%H.%u.%s&quot;

 xdebug.dump_once=On
 xdebug.dump_globals=On
 xdebug.dump_undefined=On

 xdebug.dump.REQUEST=*
 xdebug.dump.SERVER=REQUEST_METHOD,REQUEST_URI,HTTP_USER_AGENT

 xdebug.show_exception_trace=On
 xdebug.show_local_vars=1
 xdebug.var_display_max_depth=6

 xdebug.max_nesting_level=50
EOF

%postun
rm -rf %&#123;php_dir&#125;/etc/php.d/xdebug.ini
rm -rf /data/logs/xdebug

%clean
rm -Rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%&#123;php_extdir&#125;/xdebug.so
</textarea><br/><br/><br/><br/>下载图形化工具kcachegrind在windows下的可执行版 下载地址http://sourceforge.net/projects/precompiledbin/files&nbsp;&nbsp; 用kcachegrind来看会更形象，注意需要修改从linux中执行的文件的php文件路径，这样就可以了sourcecode.<br/>原文：https://blog.csdn.net/gdfjhc/article/details/84194948 
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [实践OK]centos安装php版本对应的扩展xdebug链接以及因Xdebug版本太高WinCacheGrind无法解析只得采用kcachegrind并安装用kcachegrind系统分析,后缀变为callgrind。支持swoole的Xdebug版本。]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>