<?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; apache</title>
	<atom:link href="http://zenovations.com/blog/tag/apache/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>creating response headers</title>
		<link>http://zenovations.com/blog/2011/10/creating-response-headers/</link>
		<comments>http://zenovations.com/blog/2011/10/creating-response-headers/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 16:04:41 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[response headers]]></category>

		<guid isPermaLink="false">http://zenovations.com/blog/?p=259</guid>
		<description><![CDATA[PHPWeby has a great article on how to create response headers for various means, such as 503, file download dialog, apache authentication, and so on. http://phpweby.com/tutorials/php/35 &#160; &#160;]]></description>
			<content:encoded><![CDATA[<p>PHPWeby has a great article on how to create response headers for various means, such as 503, file download dialog, apache authentication, and so on.</p>
<p><a href="http://phpweby.com/tutorials/php/35">http://phpweby.com/tutorials/php/35</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://zenovations.com/blog/2011/10/creating-response-headers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>Unable to start Apache, port 80 in use&#8211;Skype bastard process</title>
		<link>http://zenovations.com/blog/2010/05/unable-to-start-apache-port-80-in-use-skype-bastard-process/</link>
		<comments>http://zenovations.com/blog/2010/05/unable-to-start-apache-port-80-in-use-skype-bastard-process/#comments</comments>
		<pubDate>Sat, 29 May 2010 19:24:55 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[skype]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[xampp]]></category>

		<guid isPermaLink="false">http://zenovations.com/blog/?p=191</guid>
		<description><![CDATA[Today I was unable to start Apache using a new install of XAMPP. A quick netstat -o in cmd showed something was blocking port 80. After about an hour of searching, I discovered that port 80 was in use by Skype. No kidding. There is an advanced setting in skype to &#8220;Use port 80 and [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was unable to start Apache using a new install of XAMPP. A quick netstat -o in cmd showed something was blocking port 80.</p>
<p>After about an hour of searching, I discovered that port 80 was in use by Skype. No kidding. There is an advanced setting in skype to &#8220;Use port 80 and 443 as alternate incoming connections.&#8221; If this is checked (which it is by default) then a service is started on port 80 that blocks Apache. Ungh for bad ideas and even worse defaults.</p>
]]></content:encoded>
			<wfw:commentRss>http://zenovations.com/blog/2010/05/unable-to-start-apache-port-80-in-use-skype-bastard-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redirect domain to subfolder on different site</title>
		<link>http://zenovations.com/blog/2009/04/redirect-domain-to-subfolder-on-different-site/</link>
		<comments>http://zenovations.com/blog/2009/04/redirect-domain-to-subfolder-on-different-site/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 19:35:11 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://zenovations.com/blog/?p=41</guid>
		<description><![CDATA[Wanted to redirect our old standby, pastebin.zentrack.net to the new location, dev.zentrack.net/pastebin. Took a bit of mojo to find the answer to that problem. I decided on using apache and bypass virtualmin&#8217;s admin tools. The &#8220;Rewrite&#8221; Approach Here is an approach using a rewrite rule, that preserves files and query parms from the original entry. [...]]]></description>
			<content:encoded><![CDATA[<p>Wanted to redirect our old standby, pastebin.zentrack.net to the new location, dev.zentrack.net/pastebin. Took a bit of mojo to find the answer to that problem. I decided on using apache and bypass virtualmin&#8217;s admin tools.</p>
<h3>The &#8220;Rewrite&#8221; Approach</h3>
<p>Here is an approach using a rewrite rule, that preserves files and query parms from the original entry. This takes widgets.mysite.com/files/?id=20 and redirects it to www.mysite.com/widgets/files/?id=20:</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('p41code17'); return false;">View Code</a> LANGUAGE</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4117"><td class="code" id="p41code17"><pre class="language" style="font-family:monospace;">RewriteCond %{HTTP_HOST} ^(www\.)?subdomain\.mainsite\.com
RewriteRule (.*) http://www.mainsite.com/subdirectory$1 [L,R=permanent]</pre></td></tr></table></div>

<p><code>%{HTTP_HOST}</code> is an apache variable that refers to the current domain entered in browser.<br />
<br /><code>(www\.)</code> makes it possible to redirect widgets.mysite.com or www.widgets.mysite.com.<br />
<br /><code>/subdirectory </code>is where you specify which directory the redirect drops them in.<br />
<br /><code>(/.+)?</code> bit is what adds on any details after the url.<br />
<br /><code>[L, R=permanent]</code> is based on <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteCond">Apache&#8217;s RewriteCond options</a>, and tells apache we actually want to change the url in the browser, instead of just showing the correct page at this url.</p>
<h3>The &#8220;Redirect&#8221; Approach</h3>
<p>A simpler approach is to create a hard redirect like the following. This takes widgets.mysite.com/files/?id=20 and redirects it to www.mysite.com/widgets/:</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('p41code18'); return false;">View Code</a> INI</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4118"><td class="code" id="p41code18"><pre class="ini" style="font-family:monospace;">ServerAlias subdomain.mainsite.com
RewriteEngine on
RewriteCond %<span style="">&#123;</span>HTTP_HOST<span style="">&#125;</span> ^subdomain.mainsite.com$ <span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>OR<span style="">&#93;</span></span> 
RewriteCond %<span style="">&#123;</span>HTTP_HOST<span style="">&#125;</span> ^www.subdomain.mainsite.com$ 
RewriteRule ^<span style="">&#40;</span>.*<span style="">&#41;</span>$ http://www.mainsite.com/subdirectory <span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>R<span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">301,L<span style="">&#93;</span></span></span></pre></td></tr></table></div>

<p>This goes into the apache config, inside mainsite.com&#8217;s VirtualHost directive.<br />
<br /><code>ServerAlias</code> directive allows the main site to also accept queries for the subdomain.<br />
You may also need to add a DNS entry, depending on your setup.<br />
<br /><code>RewriteCond </code>with www.subdomain.mainsite.com is optional and recommended&#8211;if you remove it, also remove the <code>[OR]</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://zenovations.com/blog/2009/04/redirect-domain-to-subfolder-on-different-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

