<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>绿色记忆 &#187; XDebug</title>
	<atom:link href="https://blog.gmem.cc/tag/xdebug/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.gmem.cc</link>
	<description></description>
	<lastBuildDate>Thu, 16 Apr 2026 11:50:59 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.14</generator>
	<item>
		<title>PhpStorm知识集锦</title>
		<link>https://blog.gmem.cc/phpstorm-faq</link>
		<comments>https://blog.gmem.cc/phpstorm-faq#comments</comments>
		<pubDate>Thu, 12 May 2016 09:58:32 +0000</pubDate>
		<dc:creator><![CDATA[Alex]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[IntelliJ]]></category>
		<category><![CDATA[XDebug]]></category>

		<guid isPermaLink="false">https://blog.gmem.cc/?p=11503</guid>
		<description><![CDATA[<p>基础知识 简介 PHPStorm是一个基于IntelliJ平台跨平台的PHP集成开发环境，支持从5.3到最新的7.0的PHP版本。该IDE同时包含了WebStorm的功能，因此如果购买了PHPStorm，不需要再购买WebStorm。 部署 PhpStorm支持将工程部署到本地或者远程服务器，或者从远程服务器同步到本地。对于远程服务器，需要进行FTP或者SFTP的配置。 部署到本地服务器 File ⇨ Settings，定位到B,E,D ⇨ Deployment，点击右侧面板的+号，出现类似下面的界面： 勾选Visible only for this project则其它工程无法看到此部署配置，Folder填写本地HTTP服务器的部署根目录。 切换到Mappings选项卡，可以配置工程中目录与服务器目录的映射关系： 在选项卡Excluded Paths中，可以排除掉不需要在工程、服务器之间同步的文件。 执行部署操作 在Project窗口中，右击某个节点，或者在编辑器上右击，均可执行Upload to Server name操作，完成部署。 <a class="read-more" href="https://blog.gmem.cc/phpstorm-faq">[...]</a></p>
<p>The post <a rel="nofollow" href="https://blog.gmem.cc/phpstorm-faq">PhpStorm知识集锦</a> appeared first on <a rel="nofollow" href="https://blog.gmem.cc">绿色记忆</a>.</p>
]]></description>
				<content:encoded><![CDATA[<div class="wri_content_clear_both"><div class="blog_h1"><span class="graybg">基础知识</span></div>
<div class="blog_h2"><span class="graybg">简介</span></div>
<p>PHPStorm是一个基于IntelliJ平台跨平台的PHP集成开发环境，支持从5.3到最新的7.0的PHP版本。该IDE同时包含了WebStorm的功能，因此如果购买了PHPStorm，不需要再购买WebStorm。</p>
<div class="blog_h2"><span class="graybg">部署</span></div>
<p>PhpStorm支持将工程<span style="background-color: #c0c0c0;">部署</span>到本地或者远程服务器，或者从远程服务器<span style="background-color: #c0c0c0;">同步</span>到本地。对于远程服务器，需要进行FTP或者SFTP的配置。</p>
<div class="blog_h3"><span class="graybg">部署到本地服务器</span></div>
<p>File ⇨ Settings，定位到B,E,D ⇨ Deployment，点击右侧面板的+号，出现类似下面的界面：</p>
<p><img class="aligncenter size-full wp-image-11525" src="https://blog.gmem.cc/wp-content/uploads/2016/05/Selection_006.png" alt="Selection_006" width="100%" /></p>
<p>勾选Visible only for this project则其它工程无法看到此部署配置，Folder填写本地HTTP服务器的部署根目录。</p>
<p>切换到Mappings选项卡，可以配置工程中目录与服务器目录的映射关系：</p>
<p><img class="aligncenter size-full wp-image-11526" src="https://blog.gmem.cc/wp-content/uploads/2016/05/Selection_007.png" alt="Selection_007" width="100%" /></p>
<p>在选项卡Excluded Paths中，可以排除掉不需要在工程、服务器之间同步的文件。</p>
<div class="blog_h3"><span class="graybg">执行部署操作</span></div>
<p>在Project窗口中，右击某个节点，或者在编辑器上右击，均可执行Upload to Server name操作，完成部署。</p>
<p>注意在Debug时，必须先把工程中修改的文件部署到服务器上。</p>
<div class="blog_h2"><span class="graybg">调试</span></div>
<p>File ⇨ Settings，定位到Languages &amp; Frameworks ⇨ PHP ⇨ Debug，参考下图设置：</p>
<p><img class="aligncenter size-full wp-image-11512" src="https://blog.gmem.cc/wp-content/uploads/2016/05/Selection_004.png" alt="Selection_004" width="100%" /></p>
<p>Run ⇨ Break at first line in PHP scripts，取消勾选，否则每个PHP文件的<span style="background-color: #c0c0c0;">第一行都会中断执行</span>，很烦人。</p>
<div class="blog_h3"><span class="graybg">PHP服务器设置</span></div>
<p>File ⇨ Settings，定位到Languages &amp; Frameworks ⇨ PHP ⇨ Servers，在此对被调试的Web服务器进行配置。</p>
<p>注意<span style="background-color: #c0c0c0;">工程目录与服务器绝对路径之间的映射关系</span>要设置正确，PHP脚本在服务器上的绝对路径会在Debug会话中传递到PhpStorm，PhpStorm依据前述的映射关系确定源码位置。你必须保证工程文件和服务器文件内容一致。</p>
<p>参考下图进行设置：</p>
<p><img class="aligncenter size-full wp-image-11516" src="https://blog.gmem.cc/wp-content/uploads/2016/05/Selection_0021.png" alt="Selection_002" width="100%" /></p>
<div class="blog_h3"><span class="graybg">Run/Debug配置</span></div>
<p>你还需要配置调试的入口点。点击工具栏<img class="aligncenter size-full wp-image-11521 inlineBlock" src="https://blog.gmem.cc/wp-content/uploads/2016/05/Selection_0041.png" alt="Selection_004" width="46" height="17" /> 左侧的下拉按钮，选择Edit Configurations，点击+号，选择PHP Web Application，参考下图进行设置：</p>
<p><img class="aligncenter size-large wp-image-11522" src="https://blog.gmem.cc/wp-content/uploads/2016/05/Selection_005-1024x411.png" alt="Selection_005" width="100%" /></p>
<p>注意，如果你的服务器使用HTTPS协议，则Start URL必须填写完整的URL。</p>
<div class="blog_h3"><span class="graybg">执行调试</span></div>
<p>选中刚刚完成的Debug配置，按Alt + Shift + D或者点击工具栏上的甲虫图标即可启动调试，顺利的话，程序将在你设置好的断点处暂停。</p>
<div class="blog_h1"><span class="graybg">常见问题</span></div>
<div class="blog_h2"><span class="graybg">零散问题</span></div>
<div class="blog_h3"><span class="graybg">如何移除编辑器中的水平横线</span></div>
<p>默认情况下PHPStorm的编辑器，在类、方法前面显示一条水平横线作为分隔符，要去除，可以按如下步骤：</p>
<p>Preferences ⇨  Editor  ⇨ Colors &amp; Fonts  ⇨ General ⇨ Code ⇨ Method separator color，取消颜色设置。</p>
</div><p>The post <a rel="nofollow" href="https://blog.gmem.cc/phpstorm-faq">PhpStorm知识集锦</a> appeared first on <a rel="nofollow" href="https://blog.gmem.cc">绿色记忆</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.gmem.cc/phpstorm-faq/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows下使用Eclipse PDT + XAMPP + XDebug调试PHP</title>
		<link>https://blog.gmem.cc/debug-php-with-eclipse-pdt-and-xdebug</link>
		<comments>https://blog.gmem.cc/debug-php-with-eclipse-pdt-and-xdebug#comments</comments>
		<pubDate>Fri, 08 Mar 2013 10:20:03 +0000</pubDate>
		<dc:creator><![CDATA[Alex]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[PDT]]></category>
		<category><![CDATA[XDebug]]></category>

		<guid isPermaLink="false">http://blog.gmem.cc/?p=686</guid>
		<description><![CDATA[<p>环境说明：Windows 7 X64，Eclipse 4.3.2，XAMPP 1.8.3 XDebug的设置 定位到%XAMPP_HOME%\php\php.ini，打开编辑 [crayon-69e1c0c15914d336394594/] Eclipse配置 Windows- Preferences - PHP - PHP Servers，添加服务器，注意Base URL和xdebug的域名保持对应： 最好避免使用Path Mapping————保持URI路径和Eclipse工程名称对应，我的环境下（Eclipse 4.3.2）出现无法识别断点的问题，没查出原因。 Windows- Preferences <a class="read-more" href="https://blog.gmem.cc/debug-php-with-eclipse-pdt-and-xdebug">[...]</a></p>
<p>The post <a rel="nofollow" href="https://blog.gmem.cc/debug-php-with-eclipse-pdt-and-xdebug">Windows下使用Eclipse PDT + XAMPP + XDebug调试PHP</a> appeared first on <a rel="nofollow" href="https://blog.gmem.cc">绿色记忆</a>.</p>
]]></description>
				<content:encoded><![CDATA[<div class="wri_content_clear_both"><p>环境说明：Windows 7 X64，Eclipse 4.3.2，XAMPP 1.8.3</p>
<p><strong>XDebug的设置</strong><br /> 定位到%XAMPP_HOME%\php\php.ini，打开编辑</p>
<pre class="crayon-plain-tag">[XDebug]
zend_extension = "D:\JavaEE\container\xampp\1.8.3\php\ext\php_xdebug.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "D:\JavaEE\container\xampp\1.8.3\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
;启用远程调试
xdebug.remote_enable = 1
;调试客户端IP地址或者主机名
xdebug.remote_host = "gmem.cc"
;端口和Eclipse PDT保持一致
xdebug.remote_port = 9000
xdebug.remote_handler = "dbgp"
xdebug.trace_output_dir = "D:\JavaEE\container\xampp\1.8.3\tmp"</pre>
<p><strong>Eclipse配置</strong><br /> Windows- Preferences - PHP - PHP Servers，添加服务器，注意Base URL和xdebug的域名保持对应：<br /> <img src="https://blog.gmem.cc/wp-content/uploads/2013/03/eclipse-php-server-cfg.jpg" alt="eclipse-php-server-cfg" /><br /> 最好避免使用Path Mapping————保持URI路径和Eclipse工程名称对应，我的环境下（Eclipse 4.3.2）出现无法识别断点的问题，没查出原因。</p>
<p>Windows- Preferences - PHP - Debug，参考下图进行设置：<br /> <img src="https://blog.gmem.cc/wp-content/uploads/2013/03/eclipse-php-debug-cfg.jpg" alt="eclipse-php-debug-cfg" /></p>
<p>Windows- Preferences - PHP - Debug - Workbench Options，参考下图进行设置：<br /> PHP Debug View可以实时看到PHP输出的HTML内容<br /> <img src="https://blog.gmem.cc/wp-content/uploads/2013/03/eclipse-php-debug-cfg2.jpg" alt="eclipse-php-debug-cfg2" /></p>
<p><strong>Apache配置</strong><br /> 定位到%XAMPP_HOME%\apache\conf\httpd.conf，添加：</p>
<pre class="crayon-plain-tag">&lt;IfModule dir_module&gt;
    DirectoryIndex index.html index.php index.htm
    Alias /blog "D:/JavaEE/projects/eclipse/4.3.2/gmem-blog"
    &lt;Directory D:/JavaEE/projects/eclipse/4.3.2/gmem-blog&gt;
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
    &lt;/Directory&gt;
&lt;/IfModule&gt;</pre>
<p>注意Alias是PHP工程的部署URI，Eclipse工程的名称最好和它对应，避免麻烦。</p>
<p><strong>调试测试</strong><br /> 写几个PHP，使用include进行页面包含，然后设置一些端点，在PHP上点击右键，Debug As - PHP Web Application，确认程序在断点处暂停，Debug Output View输出对应的HTML内容。</p>
</div><p>The post <a rel="nofollow" href="https://blog.gmem.cc/debug-php-with-eclipse-pdt-and-xdebug">Windows下使用Eclipse PDT + XAMPP + XDebug调试PHP</a> appeared first on <a rel="nofollow" href="https://blog.gmem.cc">绿色记忆</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.gmem.cc/debug-php-with-eclipse-pdt-and-xdebug/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu下安装PHP</title>
		<link>https://blog.gmem.cc/php-under-ubuntu</link>
		<comments>https://blog.gmem.cc/php-under-ubuntu#comments</comments>
		<pubDate>Tue, 27 Dec 2011 13:00:10 +0000</pubDate>
		<dc:creator><![CDATA[Alex]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[XDebug]]></category>
		<category><![CDATA[容器化]]></category>

		<guid isPermaLink="false">http://blog.gmem.cc/?p=1184</guid>
		<description><![CDATA[<p>PHP5安装 安装必要的软件： [crayon-69e1c0c1595ce659249494/] 修改配置： 注意：Web服务器下编写info.php可以获知php.ini位置 [crayon-69e1c0c1595d2282894915/] XDebug安装 安装必要的软件： [crayon-69e1c0c1595d4352675383/] 修改配置文件：  [crayon-69e1c0c1595d6516842895/] 重启Apache服务 [crayon-69e1c0c1595d9105848355/] 现在调试客户端可以连接并进行调试了，需要注意的是，服务器必须能够连接到调试客户端。在调试位于外网服务器的PHP页面时，处于内网的调试客户端可能无法被直接访问，这时候最简单的方式就是使用VPN连接到服务器，上面的xdebug.remote_host填写VPN连接分配给客户端的IP地址即可。  调试完毕后，可以关闭xdebug模块： [crayon-69e1c0c1595db700333021/] 验证XDebug正常工作 可以执行[crayon-69e1c0c1595dd198808459-i/]命令，如果输出： [crayon-69e1c0c1595df473018019/]  说明XDebug正常加载。如果输出： [crayon-69e1c0c1595e1159888346/] 说明PHP引擎和XDebug的版本不兼容。 <a class="read-more" href="https://blog.gmem.cc/php-under-ubuntu">[...]</a></p>
<p>The post <a rel="nofollow" href="https://blog.gmem.cc/php-under-ubuntu">Ubuntu下安装PHP</a> appeared first on <a rel="nofollow" href="https://blog.gmem.cc">绿色记忆</a>.</p>
]]></description>
				<content:encoded><![CDATA[<div class="wri_content_clear_both"><div class="blog_h2"><span class="graybg">PHP5安装</span></div>
<p>安装必要的软件：</p>
<pre class="crayon-plain-tag">sudo apt-get install php5-cgi</pre>
<p>修改配置：</p>
<p>注意：Web服务器下编写info.php可以获知php.ini位置</p>
<pre class="crayon-plain-tag">vim /etc/php5/apache2/php.ini 
#根据需要修改以下内容：
#最大上传文件的大小
upload_max_filesize = 20M 
#错误报告相关配置
error_reporting = E_ALL
display_errors = On
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
error_log = /var/log/php_errors.log
ignore_repeated_errors = Off
report_memleaks = On
track_errors = On</pre>
<div class="blog_h2"><span class="graybg">XDebug安装</span></div>
<p>安装必要的软件：</p>
<pre class="crayon-plain-tag"># 安装XDebug
apt-get install php5-xdebug

# 上述安装方法，有可能安装不匹配的XDebug版本，你可以使用PHP提供的扩展管理器PECL来安装，确保版本兼容：
# 要使用PECL，必须安装PHP的开发版本 sudo apt-get install php5-dev
# 安装PHP5最新稳定版本的XDebug
sudo pecl install php5-xdebug

# 启用PHP模块
php5enmod xdebug</pre>
<p>修改配置文件： </p>
<pre class="crayon-plain-tag">#下面这一行不要忘记
[XDebug]
xdebug.remote_autostart = 0

zend_extension="/usr/lib/php5/20121212/xdebug.so"
#禁用性能剖析
xdebug.profiler_enable = 0
#启用远程调试
xdebug.remote_enable = 1
#调试客户端IP地址或者主机名
xdebug.remote_host = 172.21.0.100
#调试客户端的监听端口
xdebug.remote_port = 9000
#是否启用回连，即由服务器主动连接调试客户端，服务器通过检查HTTP请求得知客户端的IP
#启用该选项时xdebug.remote_host无意义
xdebug.remote_connect_back = 0
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = req
#所有的远程调试连接都会被记录到该日志
xdebug.remote_log = /var/log/xdebug.log</pre>
<div class="blog_h3"><span class="graybg">重启Apache服务</span></div>
<pre class="crayon-plain-tag">service apache2 restart</pre>
<p>现在调试客户端可以连接并进行调试了，需要注意的是，服务器必须能够连接到调试客户端。在调试位于外网服务器的PHP页面时，处于内网的调试客户端可能无法被直接访问，这时候最简单的方式就是使用VPN连接到服务器，上面的xdebug.remote_host填写VPN连接分配给客户端的IP地址即可。 </p>
<p>调试完毕后，可以关闭xdebug模块：</p>
<pre class="crayon-plain-tag">php5dismod xdebug

#在我的服务器上测试，即使禁用仍然对Apache2的性能产生影响，因此可以删除，需要的时候重新安装
apt-get remove php5-xdebug</pre>
<div class="blog_h3"><span class="graybg">验证XDebug正常工作</span></div>
<p>可以执行<pre class="crayon-plain-tag">php -v</pre>命令，如果输出：</p>
<pre class="crayon-plain-tag">PHP 5.6.30 (cli) (built: Feb 28 2017 17:33:47) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans</pre>
<p> 说明XDebug正常加载。如果输出：</p>
<pre class="crayon-plain-tag">Xdebug requires Zend Engine API version 220121212.
The Zend Engine API version 220131226 which is installed, is newer.
Contact Derick Rethans at http://xdebug.org/docs/faq#api for a later version of Xdebug.</pre>
<p>说明PHP引擎和XDebug的版本不兼容。</p>
<p>也可以通过phpinfo来验证，正常加载时，页面存在以下内容：</p>
<p><img class="aligncenter size-full wp-image-15104" src="https://blog.gmem.cc/wp-content/uploads/2011/12/phpinfo-xdebug.png" alt="phpinfo-xdebug" width="100%" /></p>
<div class="blog_h2"><span class="graybg">PHP7安装</span></div>
<pre class="crayon-plain-tag"># 独立构建并安装，避免影响系统既有PHP版本
tar xf php-7.0.6.tar.bz2
cd php-7.0.6
# 设置安装目录
./configure --prefix=/home/alex/PHP/7.0.6
make &amp;&amp; make install</pre>
<p>构建并安装XDebug：</p>
<pre class="crayon-plain-tag"># 安装XDebug
/home/alex/PHP/7.0.6/bin/php -i &gt; php7.txt
# 把输出拿到https://xdebug.org/wizard.php分析，该网站会显示如何构建XDebug
tar -xvzf xdebug-2.4.0.tgz
cd xdebug-2.4.0
/home/alex/PHP/7.0.6/bin/phpize
./configure --with-php-config=/home/alex/PHP/7.0.6/bin/php-config
make
cp modules/xdebug.so /home/alex/PHP/7.0.6/lib/php/extensions/no-debug-non-zts-20151012</pre>
<p>修改 /home/alex/PHP/7.0.6/lib/php.ini，添加：</p>
<pre class="crayon-plain-tag">[XDebug]
xdebug.remote_autostart = 0
zend_extension = /home/alex/PHP/7.0.6/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so
xdebug.profiler_enable = 0
xdebug.remote_enable = 1
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
xdebug.remote_connect_back = 0
xdebug.remote_handler = "dbgp"
xdebug.remote_mode = req
xdebug.remote_log = /home/alex/PHP/7.0.6/var/log/xdebug.log</pre>
<div class="blog_h2"><span class="graybg">容器化</span></div>
<div class="blog_h3"><span class="graybg">PHP5+Apache2</span></div>
<p>参考：<a href="/apache2-under-ubuntu#containerization">Ubuntu下安装Apache2服务器</a></p>
<div class="blog_h2"><span class="graybg">常见问题</span></div>
<div class="blog_h3"><span class="graybg">PHP Fatal error: Call to undefined function curl_init()</span></div>
<p>more /var/log/apache2/error.log，发现错误该错误，原因：未安装CURL支持，解决方式：</p>
<pre class="crayon-plain-tag">apt-get install php5-curl
service apache2 restart</pre>
<p>&nbsp;</p>
</div><p>The post <a rel="nofollow" href="https://blog.gmem.cc/php-under-ubuntu">Ubuntu下安装PHP</a> appeared first on <a rel="nofollow" href="https://blog.gmem.cc">绿色记忆</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.gmem.cc/php-under-ubuntu/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
