<?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>Zenovation's Blog &#187; debugging</title>
	<atom:link href="http://zenovations.com/blog/tag/debugging/feed/" rel="self" type="application/rss+xml" />
	<link>http://zenovations.com/blog</link>
	<description>A blog about web design, programming, hosting, and virtualmin hacks</description>
	<lastBuildDate>Mon, 16 Jan 2012 15:01:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>remote debugging PHP for a single virtualhost with PhpStorm and xdebug</title>
		<link>http://zenovations.com/blog/2011/07/remote-debugging-php-for-a-single-virtualhost-with-phpstorm-and-xdebug/</link>
		<comments>http://zenovations.com/blog/2011/07/remote-debugging-php-for-a-single-virtualhost-with-phpstorm-and-xdebug/#comments</comments>
		<pubDate>Sun, 10 Jul 2011 01:16:30 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Web Dev]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpstorm]]></category>
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://zenovations.com/blog/?p=231</guid>
		<description><![CDATA[I struggled for several days to set up remote debugging. I wanted to be able to remotely debug a single virtualhost on my CentOS server using my local IDE (PhpStorm) and xdebug. Since this took me quite a while to figure out, I thought I&#8217;d include the steps here for others. Installing Xdebug Over SSH, [...]]]></description>
			<content:encoded><![CDATA[<p>I struggled for several days to set up remote debugging. I wanted to be able to remotely debug a single virtualhost on my CentOS server using my local IDE (<a href="http://www.jetbrains.com/phpstorm/">PhpStorm</a>) and <a href="http://xdebug.org/">xdebug</a>.</p>
<p>Since this took me quite a while to figure out, I thought I&#8217;d include the steps here for others.</p>
<h2>Installing Xdebug</h2>
<p>Over SSH, I ran the following:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p231code8'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2318"><td class="code" id="p231code8"><pre class="bash" style="font-family:monospace;">$ pecl <span style="color: #c20cb9; font-weight: bold;">install</span> xdebug</pre></td></tr></table></div>

<h2>Configuring Xdebug in php.ini</h2>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p231code9'); return false;">View Code</a> INI</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2319"><td class="code" id="p231code9"><pre class="ini" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">;;;;;;;;;;;;;;;;;;;</span>
<span style="color: #666666; font-style: italic;">; Module Settings ;</span>
<span style="color: #666666; font-style: italic;">;;;;;;;;;;;;;;;;;;;</span>
<span style="color: #000099;">zend_extension</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">/usr/lib/php/modules/xdebug.so</span>
&nbsp;
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>xdebug<span style="">&#93;</span></span>
xdebug.remote_enable<span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">1</span>
xdebug.remote_port<span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">9000</span>
xdebug.idekey<span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">PHPSTORM-XDEBUG</span>
xdebug.remote_connect_back<span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">1</span>
&nbsp;
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>Date<span style="">&#93;</span></span></pre></td></tr></table></div>

<p>Note the use of zend_extension; as of PHP 5.3, this is the only one that works (extension=&#8230;) will appear to function, but never connect!</p>
<p>Also, I used xdebug.remote_connect_back=1 &#8211; this allows connections from anywhere. But since I&#8217;ve configured my server to load a separate php.ini for each site (sorry, this is outside the scope of this discussion), and the entire site is under development and protected by .htaccess, I didn&#8217;t have to worry about other people debugging remotely.</p>
<p>An alternative to using remote_connect_back is to specify the remote_host to your <a href="http://www.whatsmyip.org/">local ip address</a>:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p231code10'); return false;">View Code</a> INI</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p23110"><td class="code" id="p231code10"><pre class="ini" style="font-family:monospace;">xdebug.remote_host<span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">0.0.0.0 </span><span style="color: #666666; font-style: italic;">;your ip address</span>
<span style="color: #666666; font-style: italic;">;xdebug.remote_connect_back=0</span></pre></td></tr></table></div>

<p><strong> Alternative: Loading via .htaccess instead of php.ini</strong></p>
<p>Alternately, I could have dropped a .htaccess file into my root directory for the virtualhost, if the php.ini for each site were too much trouble:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p231code11'); return false;">View Code</a> INI</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p23111"><td class="code" id="p231code11"><pre class="ini" style="font-family:monospace;">php_value  zend_extension<span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">/usr/lib/php/modules/xdebug.so</span>
php_flag   xdebug.remote_enable on
php_value  xdebug.remote_port <span style="">9000</span>
php_value  xdebug.idekey PHPSTORM-XDEBUG
php_flag   xdebug.remote_connect_back on</pre></td></tr></table></div>

<h2>Configuring PhpStorm</h2>
<p>I followed <a href="http://blogs.jetbrains.com/webide/2011/03/configure-php-debugging-in-phpstorm-2-0/">these instructions</a> to the letter. Make sure you set up the &#8220;PHP Remote Debug&#8221; and not the &#8220;PHP Server&#8221; option if you&#8217;re using my list here as a guide (both work, I just chose the remote)</p>
<p>Remember to get those IDEKEY values to match up in the editor and on the server!</p>
<h2>Configure Firewalls</h2>
<p>On CentOS, I use apf, so I configured my firewall by adding port 9000 into the following settings: IG_TCP_PORTS, EG_TCP_PORTS</p>
<p>Then I restarted apf:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p231code12'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p23112"><td class="code" id="p231code12"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apf restart</pre></td></tr></table></div>

<p>At home, I opened a connection in my firewall by adding a redirect for port 9000 to my personal PC.</p>
<h2>Starting it Up</h2>
<p>Remember to reload Apache&#8217;s config!</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p231code13'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p23113"><td class="code" id="p231code13"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>httpd reload</pre></td></tr></table></div>

<p>Make sure PhpStorm is set to break on first line, or you won&#8217;t know if it worked! (you need the debugger to get involved):</p>
<p><a href="http://zenovations.com/blog/wp-content/uploads/2011/07/2011-07-09-1800_03.png"><img class="alignnone size-full wp-image-234" title="2011-07-09-1800_03" src="http://zenovations.com/blog/wp-content/uploads/2011/07/2011-07-09-1800_03.png" alt="" width="554" height="259" /></a></p>
<p>&nbsp;</p>
<p>Start the PhpStorm Remote Debug:<br />
<a href="http://zenovations.com/blog/wp-content/uploads/2011/07/2011-07-09-1752_01.png"><img class="alignnone size-full wp-image-232" title="2011-07-09-1752_01" src="http://zenovations.com/blog/wp-content/uploads/2011/07/2011-07-09-1752_01.png" alt="" width="400" height="132" /></a></p>
<p>&nbsp;</p>
<p>Make sure to click the &#8220;listen for connections&#8221; icon!</p>
<p><a href="http://zenovations.com/blog/wp-content/uploads/2011/07/2011-07-09-1755_02.png"><img class="alignnone size-full wp-image-233" title="2011-07-09-1755_02" src="http://zenovations.com/blog/wp-content/uploads/2011/07/2011-07-09-1755_02.png" alt="" width="502" height="131" /></a></p>
<p>A quick note on semantics here: It is not technically necessary to have the debug server running and &#8220;listen for connections&#8221; clicked. Listen for connections will, in fact, start the debugger when an incoming connection is received. However, for initial testing, having the debugger actually ON was very helpful in being sure PhpStorm wasn&#8217;t failing to start incoming connections.</p>
<p>&nbsp;</p>
<p>Connect to your IP address from the web server to make sure it can talk to your IDE:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p231code14'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p23114"><td class="code" id="p231code14"><pre class="bash" style="font-family:monospace;">$ telnet 0.0.0.0 <span style="color: #000000;">9000</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p>Add <strong>XDEBUG_SESSION_START=PHPSTORM-XDEBUG</strong> in the URL of the site to initiate a connection:</p>
<p><a href="http://zenovations.com/blog/wp-content/uploads/2011/07/2011-07-09-1804_05.png"><img class="alignnone size-full wp-image-236" title="2011-07-09-1804_05" src="http://zenovations.com/blog/wp-content/uploads/2011/07/2011-07-09-1804_05.png" alt="" width="396" height="164" /></a></p>
<p>&nbsp;</p>
<p>Witness debugging in all its glory!</p>
<p><a href="http://zenovations.com/blog/wp-content/uploads/2011/07/2011-07-09-1807_06.png"><img class="alignnone size-full wp-image-237" title="2011-07-09-1807_06" src="http://zenovations.com/blog/wp-content/uploads/2011/07/2011-07-09-1807_06.png" alt="" width="625" height="162" /></a></p>
<p>&nbsp;</p>
<h2>Browser Plugins</h2>
<p>There are browser plugins for <a href="https://chrome.google.com/webstore/detail/eadndfjplgieldjbigjakmdgkmoaaaoc" target="_blank">Chrome </a>and <a href="https://addons.mozilla.org/en-US/firefox/addon/easy-xdebug/" target="_blank">Firefox </a>that make remote connections a breeze; you no longer have to type the parms into the URL. I&#8217;ve used both of these with success and highly recommend this simplification.</p>
]]></content:encoded>
			<wfw:commentRss>http://zenovations.com/blog/2011/07/remote-debugging-php-for-a-single-virtualhost-with-phpstorm-and-xdebug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebKit Enhancements</title>
		<link>http://zenovations.com/blog/2008/10/webkit-enhancements/</link>
		<comments>http://zenovations.com/blog/2008/10/webkit-enhancements/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 13:56:14 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[safari]]></category>

		<guid isPermaLink="false">http://zenovations.com/blog/?p=61</guid>
		<description><![CDATA[For the web devs, Safari&#8216;s WebKit has been updated, providing some great new tools for writing the web and debugging Safari issues. They also wrote up a great overview of the features. Together with Firebug the Venkman Toolbar for Firefox, that&#8217;s a great set of tools. Now if IE would just join the bandwagon and offer us more than &#8220;null is null [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>For the web devs, <a href="http://www.apple.com/safari/">Safari</a>&#8216;s WebKit has been updated, providing some great new tools for writing the web and debugging Safari issues. They also wrote up a <a href="http://webkit.org/blog/197/web-inspector-redesign/">great overview of the features</a>.</p>
<p>Together with <a href="http://getfirebug.com/">Firebug</a> the <a href="http://www.mozilla.org/projects/venkman/">Venkman</a> Toolbar for <a href="http://www.mozilla.com/en-US/firefox/">Firefox</a>, that&#8217;s a great set of tools.</p>
<p>Now if IE would just join the bandwagon and offer us more than &#8220;null is null or not an object&#8221;!</p></div>
]]></content:encoded>
			<wfw:commentRss>http://zenovations.com/blog/2008/10/webkit-enhancements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

