<?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>Havoc Inspired &#187; Tutorial</title>
	<atom:link href="http://www.havocinspired.co.uk/category/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.havocinspired.co.uk</link>
	<description>Home of Ryan Taylor</description>
	<lastBuildDate>Tue, 25 May 2010 21:20:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Use one keyboard &amp; mouse to control three computers with Synergy</title>
		<link>http://www.havocinspired.co.uk/tutorial/use-one-keyboard-mouse-to-control-three-computers-with-synergy/</link>
		<comments>http://www.havocinspired.co.uk/tutorial/use-one-keyboard-mouse-to-control-three-computers-with-synergy/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 11:57:14 +0000</pubDate>
		<dc:creator>Ryan Taylor</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Workflow]]></category>

		<guid isPermaLink="false">http://www.havocinspired.co.uk/?p=978</guid>
		<description><![CDATA[I have a MacBook-Pro connected to a 24" Cinema Display with extended desktop and a PC connected to a 20" widescreen monitor (which I turn on mainly to warm the room up) in my study. It's not a very big space and I didn't want to have two keyboards and mice on my desk so I was considering getting a KVM until I discovered Synergy.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Ftutorial%2Fuse-one-keyboard-mouse-to-control-three-computers-with-synergy%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Ftutorial%2Fuse-one-keyboard-mouse-to-control-three-computers-with-synergy%2F&amp;source=ryanhavoc&amp;style=normal&amp;service=TinyURL.com" height="61" width="50" /><br />
			</a>
		</div>
<p>I have a MacBook-Pro connected to a 24&#8243; Cinema Display with extended desktop and a PC connected to a 20&#8243; widescreen monitor (which I turn on mainly to warm the room up) in my study. It&#8217;s not a very big space and I didn&#8217;t want to have two keyboards and mice on my desk so I was considering getting a <acronym>KVM</acronym> until I discovered <a href="http://synergy2.sourceforge.net/">Synergy</a>.</p>
<blockquote><p>Synergy lets you easily share a single mouse and keyboard between multiple computers with different operating systems, each with its own display, without special hardware.  It&#8217;s intended for users with multiple computers on their desk since each system uses its own monitor(s).</p>
<p>Redirecting the mouse and keyboard is as simple as moving the mouse off the edge of your screen.  Synergy also merges the clipboards of all the systems into one, allowing cut-and-paste between systems&#8230;</p></blockquote>
<p>Sounds great right?</p>
<p>Well it is, once you&#8217;ve figured out how to set it up. To be honest <a href="http://synergy2.sourceforge.net/">Synergys configuration page</a> is so confusing I nearly gave up entirely until I found <a href="http://sourceforge.net/projects/synergykm/">SynergyKM</a>, a GUI for MacOSX.</p>
<p>I&#8217;m going to take you through an example of how Synergy can be used. In this example we have an iMac, which our keyboard and mouse are connected to, a MacBook-Pro situated to the left of the iMac and a PC situated to the right.</p>
<h2>iMac</h2>
<p>The iMac is going to be our server (the computer that our keyboard and mouse are connected to). Through trial and error with synergy I’ve found that it works best if you set the server to have a static IP address.</p>
<p>On MacOSX we have the option to set our ethernet to <strong>Using DHCP with manual address</strong>, this is handy because, as the option would suggest, all we have to enter is the IP address and the rest of our network configuration is set through DHCP by our router, so lets do this first.</p>
<div id="attachment_983" class="wp-caption aligncenter" style="width: 509px"><img class="size-full wp-image-983" title="iMac - Network-Preferences" src="http://www.havocinspired.co.uk/wp-content/uploads/2010/01/iMac-Network-Preferences-e1264112980481.jpg" alt="iMac - Network-Preferences" width="499" height="435" /><p class="wp-caption-text">Go to System Preferences &gt; Ethernet</p></div>
<p>For this example we are setting the iMac IP address to be <strong>192.168.0.10</strong>.</p>
<h3>SynergyKM software</h3>
<p><a href="http://sourceforge.net/projects/synergykm/">Download and install the SynergyKM software</a> onto the iMac. At the end of the install you&#8217;ll be presented with the option to <strong>Configure</strong> SynergyKM, this will load the SynergyKM control panel. If you miss this option you can find the control panel through <strong>System Preferences &gt; SynergyKM</strong>.</p>
<p>Once the control panel is open match the settings in the screenshot below:</p>
<div id="attachment_982" class="wp-caption aligncenter" style="width: 508px"><img class="size-full wp-image-982" title="iMac - SynergyKM" src="http://www.havocinspired.co.uk/wp-content/uploads/2010/01/iMac-e1264112851696.jpg" alt="iMac - SynergyKM" width="498" height="401" /><p class="wp-caption-text">We set the iMac to Share my keyboard and mouse</p></div>
<p>Then select the <strong>Server Configuration</strong> tab. At this stage you should only have one machine (iMac). We need to add our additional two machines, <strong>MacBook-Pro</strong> and <strong>PC</strong>.</p>
<p>Click the <strong>+</strong> twice and enter the name of each machine. You can now drag these machines to be laid out in relation to the iMac. In this example, <strong>MacBook-Pro</strong> to the left and <strong>PC</strong> to the right.</p>
<div id="attachment_984" class="wp-caption aligncenter" style="width: 508px"><a href="http://www.havocinspired.co.uk/wp-content/uploads/2010/01/iMac-Server-Configuration.jpg"><img class="size-full wp-image-984" title="iMac - SynergyKM Server Configuration" src="http://www.havocinspired.co.uk/wp-content/uploads/2010/01/iMac-Server-Configuration-e1264113070433.jpg" alt="iMac - SynergyKM Server Configuration" width="498" height="401" /></a><p class="wp-caption-text">The name of each machine is there actual hostname, this is set through System Preference &gt; Sharing on a Mac and System Properties &gt; Computer Name on a PC</p></div>
<p>Finally go back to <strong>General</strong> tab and make sure <strong>Synergy is turned on</strong>.</p>
<h2>MacBook-Pro</h2>
<p>Like with the <strong>iMac</strong> we need to <a href="http://sourceforge.net/projects/synergykm/">install the SynergyKM software</a> on the MacBook-Pro. Once you get to the SynergyKM control panel match the settings on the screenshot below:</p>
<div id="attachment_985" class="wp-caption aligncenter" style="width: 508px"><img class="size-full wp-image-985" title="MacBook-Pro - SynergyKM" src="http://www.havocinspired.co.uk/wp-content/uploads/2010/01/MacBook-Pro-e1264113223239.jpg" alt="MacBook-Pro - SynergyKM" width="498" height="401" /><p class="wp-caption-text">We set the MacBook-Pro to Connect to a shared keyboard and mouse</p></div>
<p>Then select the <strong>Client Configuration</strong> tab. Connecting the MacBook-Pro (client) to our <strong>iMac</strong> (server) is simple, we just enter the IP address for the <strong>iMac</strong> that we set earlier (<strong>192.168.0.10</strong>).</p>
<div id="attachment_986" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-986" title="Macbook-Pro - SynergyKM Client Configuration" src="http://www.havocinspired.co.uk/wp-content/uploads/2010/01/Macbook-Pro-Client-Configuration-e1264113534191.jpg" alt="Macbook-Pro - SynergyKM Client Configuration" width="500" height="401" /><p class="wp-caption-text">If you click Apply Now you should be able to move your mouse courser off of the left side of your iMac and onto the desktop of the MacBook-Pro</p></div>
<h2>PC</h2>
<p>For the PC we need to <a href="http://sourceforge.net/projects/synergy2/files/">download and install the SynergyInstaller-1.3.1.exe</a>. Once installed run the Synergy application and match the settings from the screenshot below:</p>
<div id="attachment_989" class="wp-caption aligncenter" style="width: 464px"><img class="size-full wp-image-989" title="PC - Synergy" src="http://www.havocinspired.co.uk/wp-content/uploads/2010/01/PC.jpg" alt="PC - Synergy" width="454" height="347" /><p class="wp-caption-text">Again we enter our iMac (Server) IP address, 192.168.0.10</p></div>
<p>Click the <strong>AutoStart&#8230; </strong>under Options.</p>
<div id="attachment_996" class="wp-caption aligncenter" style="width: 307px"><img class="size-full wp-image-996" title="PC - Synergy Auto Start" src="http://www.havocinspired.co.uk/wp-content/uploads/2010/01/PC-Auto-Start.jpg" alt="PC - Synergy Auto Start" width="297" height="331" /><p class="wp-caption-text">These options will lead you to believe Synergy can be set to start when your computer starts. It lies!</p></div>
<p>Install the <strong>When You Log In </strong>auto start utility. In my experience if you install the <strong>When Computer Starts</strong> utility Synergy will never start automatically.</p>
<p>If you&#8217;ve used Synergy before and know how to make it start when the computer starts I&#8217;d be interested in hearing how, so please leave a comment, however I&#8217;ve always been under the impression that no program can run prior to a Ctrl-Alt-Del and Login for security reasons?</p>
<p>Installing the <strong>When You Log In </strong>auto start utility does however cause us a small problem which I&#8217;ll cover in a moment. However at this stage if you click <strong>Start</strong> you should be able to move your mouse cursor off of the right side of your <strong>iMac</strong> and onto the desktop of the PC.</p>
<h3>PC  gotacha</h3>
<p>There always one isn&#8217;t there? Synergy works fine on PC, but only once you&#8217;ve logged in and Synergy has started up, and what would we need to log in? &#8230;a keyboard and mouse, which makes this whole setup rather pointless. To work around this we need to <strong>enable automatic logon</strong> for the PC.</p>
<p>To achieve this go to <strong>Start &gt; Run</strong> and enter <strong>control userpasswords2</strong></p>
<div id="attachment_991" class="wp-caption aligncenter" style="width: 485px"><a href="http://www.havocinspired.co.uk/wp-content/uploads/2010/01/PC-User-Accounts.jpg"><img class="size-full wp-image-991" title="PC - User Accounts" src="http://www.havocinspired.co.uk/wp-content/uploads/2010/01/PC-User-Accounts.jpg" alt="PC - User Accounts" width="475" height="512" /></a><p class="wp-caption-text">Select the User Name you want to be have automatically login and untick the Users must enter a user name and password to use this computer</p></div>
<p>Click <strong>Apply</strong>.</p>
<div id="attachment_992" class="wp-caption aligncenter" style="width: 474px"><a href="http://www.havocinspired.co.uk/wp-content/uploads/2010/01/PC-Auto-Logon.jpg"><img class="size-full wp-image-992" title="PC - Auto Logon" src="http://www.havocinspired.co.uk/wp-content/uploads/2010/01/PC-Auto-Logon.jpg" alt="PC - Auto Logon" width="464" height="254" /></a><p class="wp-caption-text">Enter the password for the user name you selected</p></div>
<p>Now when you power up the PC it will automatically logon under that account, Synergy will run at start up and you&#8217;ll be able to control it using the keyboard and mouse connected to your iMac.</p>
<p>There may obviously be occasions when you don&#8217;t want the PC to automatically logon. In this case you would need to set the PC up as the server with the <strong>iMac</strong> and <strong>MacBook-Pro</strong> as clients. You should be able to figure out how to do this from these instructions, the process is pretty much the same, and I&#8217;m guessing you&#8217;ll need to set the <strong>iMac</strong> and <strong>MacBook-Pro</strong> to automatically logon instead.</p>
<h2>Conclusion</h2>
<p>So that&#8217;s it. Hopefully from this example you can apply Synergy to your own computer layout and get rid of all the cables need for that KVM or that extra keyboard and mouse on your desk.</p>
<p>Additionally you&#8217;re not limited to only connecting three computers with Synergy, you can have as many as you like, knock yourself out!</p>
<p>If you&#8217;ve found this tutorial useful please leave a comment and let me know, I&#8217;d be interested to hear from you. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.havocinspired.co.uk/tutorial/use-one-keyboard-mouse-to-control-three-computers-with-synergy/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Edit your hosts file to test your website before it goes live</title>
		<link>http://www.havocinspired.co.uk/tutorial/edit-your-hosts-file-to-test-your-website-before-it-goes-live/</link>
		<comments>http://www.havocinspired.co.uk/tutorial/edit-your-hosts-file-to-test-your-website-before-it-goes-live/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 21:43:13 +0000</pubDate>
		<dc:creator>Ryan Taylor</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.havocinspired.co.uk/?p=958</guid>
		<description><![CDATA[This is a little trick I've picked up that helped me out quite a bit, especially when developing Wordpress sites where you need to get the paths and URLs right for everything to work properly.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Ftutorial%2Fedit-your-hosts-file-to-test-your-website-before-it-goes-live%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Ftutorial%2Fedit-your-hosts-file-to-test-your-website-before-it-goes-live%2F&amp;source=ryanhavoc&amp;style=normal&amp;service=TinyURL.com" height="61" width="50" /><br />
			</a>
		</div>
<p>This is a little trick I&#8217;ve picked up that helped me out quite a bit, especially when developing Wordpress sites where you need to get the paths and URLs right for everything to work properly.</p>
<h3>The scenario</h3>
<blockquote><p>You’re hired to do the redesign of an existing website (example.com). Your client wants to move their website to your hosting (or new hosting) when the redesign goes live. You’ve agreed on a seamless transition from old to new on one sunny Monday morning in a months time.</p>
<p>So you get to work on the site in your chosen development area, demo it to the client, they’re happy and you transfer the site to the newly configured hosting space on your server, however the name servers for example.com haven’t been changed yet, it’s only Friday and the redesign isn’t going live until Monday, but you’re a contentious developer and you want to test the new design to ensure everything is working as expected in the live environment.</p>
<p>What do you do?</p></blockquote>
<h3>Our goal</h3>
<p>We’re going to edit the hosts file on our Mac to make our servers IP address (e.g. 70.26.55.80) resolve to example.com, just like what a DNS server does when example.com&#8217;s name servers have been changed to point to the new hosting.</p>
<h3>Configuring the server</h3>
<p>All server configurations are different but the principle is generally the same, we need to find out/set our example.com to appear in the web browser when we visit our example IP of 70.26.55.80. For this example I’m going to explain the process on a Plesk driven server (from this you should be able to get an idea of how this would be achieved through other management software packages).</p>
<ul>
<li>Configure your web space for example.com and upload all your files to it</li>
<li>Login to Plesk</li>
<li>Select <strong>Server</strong> from the left-hand menu</li>
<li>Go to the <strong>IP Addresses</strong> – This should present you with a list of IP addresses assigned to your server,  when you configured the hosting for example.com you will have selected one of these IP addresses (you may even only have one IP address in this list)</li>
<li>For each IP address there’s a column titled <strong>Hosting</strong> with a link showing the number of domains assigned to that IP address, click the link that corresponds with the IP address you selected for the web space</li>
<li>Select <strong>example.com</strong> and click<strong> Set As Default </strong>- You can only select one default domain to be displayed if you visit that IP address in a browser</li>
<li>Make a note of the IP address (e.g. 70.26.55.80)</li>
<li>Visit 70.26.55.80 in a web browser – You should be presented with your newly uploaded site for example.com</li>
</ul>
<h3>Editing the hosts file</h3>
<p>Mac’s have a hosts file that we can edit to make 70.26.55.80 resolve to example.com just as if the name servers for example.com had already been changed (obviously this only effects the Mac you are on).</p>
<p>I’m sure you’ll be able to do this on a PC as well but don’t ask me how, I’m a Mac man.</p>
<ul>
<li>Open a <strong>Terminal</strong></li>
<li>Enter <code>sudo vim /etc/hosts</code> then enter your administrator password</li>
</ul>
<p>This will open the hosts file in the vim editor. You should see something like this:</p>
<pre class="brush: plain;">
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost
</pre>
<p>To edit the file press ‘<strong>a</strong>’, cursor down to the bottom of the list and enter:</p>
<pre class="brush: plain;">
70.26.55.80       example.com
</pre>
<p>Press ‘<strong>esc</strong>’ then enter ‘<strong>:wp</strong>’ to write and quit vim.</p>
<p>If you now visit example.com in your web browser it should resolve to 70.26.55.80 (the new hosting) and you can test your newly designed site in its live environment.</p>
<p>Now all that has to be done to make the site seamless go live on Monday is change the name servers for example.com to point to your hosting and you can guarantee that everything will work.</p>
<p><em>Important note: Remember to take the entry for example.com out of your hosts file when you have finished testing, otherwise you may end up seeing a false representation of what is actually being displayed at that domain when the name servers are changed!</em></p>
<p>Final Tip: Instead of removing the line completely from your hosts file simply add a # to the beginning of the line. This &#8220;comments out&#8221; the line and stops it from being applied. If this is a process that you are going to use regularly in the future then the line is already in your hosts file and you can simply remove the # and change the domain name when you need to.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.havocinspired.co.uk/tutorial/edit-your-hosts-file-to-test-your-website-before-it-goes-live/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Plesk, PEAR, include_paths, open_basedir and Media Temple</title>
		<link>http://www.havocinspired.co.uk/tutorial/plesk-pear-include_paths-open_basedir-and-media-temple/</link>
		<comments>http://www.havocinspired.co.uk/tutorial/plesk-pear-include_paths-open_basedir-and-media-temple/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 23:52:04 +0000</pubDate>
		<dc:creator>Ryan Taylor</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Media Temple]]></category>
		<category><![CDATA[PEAR]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.havocinspired.co.uk/?p=740</guid>
		<description><![CDATA[In this tutorial I'll talk you through enabling PEAR packages on a server running the Plesk control panel.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Ftutorial%2Fplesk-pear-include_paths-open_basedir-and-media-temple%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Ftutorial%2Fplesk-pear-include_paths-open_basedir-and-media-temple%2F&amp;source=ryanhavoc&amp;style=normal&amp;service=TinyURL.com" height="61" width="50" /><br />
			</a>
		</div>
<p>If you <a href="http://www.havocinspired.co.uk/freelance/so-i-got-hacked/">follow my blog</a> you’ll know that I’ve recently moved to <a href="http://www.mediatemple.net">Media Temple</a> as my hosting provider. I’ve gone for a <a href="http://mediatemple.net/webhosting/dv/">Dedicated Virtual</a> server and so far I’m very pleased with the flexibility I have with it.</p>
<p>Media Temples’ servers, like many other providers, run <a href="http://www.parallels.com/uk/products/plesk/">Plesk</a> as their control panel which means there are a few quirks that need to be overcome.</p>
<p>I should say at this point that I don’t claim to be a Linux/Plesk expert, i simple know enough to find my way around (or enough to be dangerous depending on who you’re asking).</p>
<h3>Default behaviour</h3>
<p>By default Plesk uses the <a href="http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.open-basedir">PHP open_basedir</a> directive to limit access to files outside a sites directory-tree. So if you have setup the domain example.com all your files go into the httpdocs folder (unless you’re using an SSL certificate in which case they go in the httpsdocs folder). For our example.com domain the server path would be:</p>
<pre class="brush: bash;">/var/www/vhosts/example.com/httpdocs</pre>
<p>Plesk’s default value for open_basedir is:</p>
<pre class="brush: bash;">/var/www/vhosts/example.com</pre>
<p>Which means any PHP script you place in the httpdocs cannot dig any further down the directory-tree than the example.com folder.</p>
<p>This is a security measure.</p>
<h3>The problem</h3>
<p>There are two scenarios (that I’ve come across) where this is a problem. The first is if you want to use <a href="http://pear.php.net/">PEAR</a>, which is the scenario I’m most common with and will be covering the solution for here, and the second is if you want to use the Expression Engine Multi Site Manager.</p>
<p>Both require PHP scripts to access files outside of their directory-tree.</p>
<h3>The solution</h3>
<p>To enable access to PEAR packages we need to add the server path to the open_basedir variable as well as the include_path variable. If you’re on a Media Temple server like me the path should be:</p>
<pre class="brush: bash;">/usr/share/pear</pre>
<p>If not you’ll need to locate the folder that PEAR is installed in on your server.</p>
<h4>Step 1 &#8211; SSH to the server</h4>
<p>You need to SSH into your server, if you are with Media Temple and this is the first time you are trying to do this, you’ll first need to enable Root Access for your domain through your <a href="https://ac.mediatemple.net/">Media Temple Account Center</a>.</p>
<p>If you’re on a Mac you can use Terminal to SSH to your server with:</p>
<pre class="brush: bash;">ssh admin@example.com</pre>
<p>Then your passworld.</p>
<p>If you’re on a PC you can use <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">Putty</a>. My memory is fuzzy on the exact use however, so you’ll need to consult the manual.</p>
<p>Once you are connected to your server you will need to switch user to root for the next step. To do this enter:</p>
<pre class="brush: bash;">su - root</pre>
<p>Then your password.</p>
<h4>Step 2 &#8211; Create a vhost.conf file</h4>
<p>Be careful, you now have godly control of your server!</p>
<p>We now need to create a vhost.conf file for our example.com domain which will override Plesk’s default settings.</p>
<p>The following command will create the file:</p>
<pre class="brush: bash;">vim /var/www/vhosts/example.com/conf/vhost.conf</pre>
<p>If you’ve never used vim (which is an editor for Linux) you need to know that pressing the &#8216;<strong>a</strong>&#8216; key puts you into author mode and the &#8216;<strong>esc</strong>&#8216; key takes you out (this is about the extent of my vim knowledge, I hope you are impressed!).</p>
<p>While in author mode enter the following information:</p>
<pre class="brush: bash;">
&lt;Directory &quot;/home/httpd/vhosts/example.com/httpdocs&quot;&gt;
php_admin_value open_basedir &quot;/home/httpd/vhosts/example.com/httpdocs:/usr/share/pear:/tmp&quot;
php_admin_value safe_mode Off
php_admin_value include_path &quot;.:/usr/share/pear&quot;
&lt;/Directory&gt;
</pre>
<p>To save the file and quit, press the &#8216;<strong>esc</strong>&#8216; key to leave author mode and type &#8216;<strong>:wq</strong>&#8216; (write and quit) and press enter.</p>
<p>So you can see that we specify the location of our example.com domain, added /usr/share/pear to the open_basedire variable and turned off safe_mode&#8230;?</p>
<p>PHP documentation states that open_basedir isn’t effected by safe_mode being on or off however from my experience if you don’t have it turned off, PEAR doesn’t work, as I say I’m no expert so maybe someone can enlighten me?</p>
<p>You can also see that we set the PHP include_path to also include /usr/share/pear</p>
<h4>A little gotcha</h4>
<p>We use php_admin_value to set the include_path. This means that the include path cannot be change using the PHP <a href="http://php.net/manual/en/function.set-include-path.php">set_include_path</a> function.</p>
<p>If you want to be able to change the include_path from within your script, perhaps you want to include a folder containing your own classes for example, you need to change:</p>
<pre class="brush: bash;">php_admin_value include_path &quot;.:/usr/share/pear&quot;</pre>
<p>To:</p>
<pre class="brush: bash;">php_value include_path &quot;.:/usr/share/pear&quot;</pre>
<h3>Step 3 &#8211; The scary bit! Reconfigure and restart apache</h3>
<p>You now need to run the following command so that the server knows to use our new vhost.conf file:</p>
<pre class="brush: bash;">/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=example.com</pre>
<p>And then restart apache:</p>
<pre class="brush: bash;">
/etc/init.d/httpd stop
/etc/init.d/httpd start
</pre>
<h3>Conclusion</h3>
<p>That should be it, you’re all PEAR’ed up and ready to go. You should note that this configuration will only effect the example.com domain. If you create a new domain you&#8217;ll have to create a vhost.conf file for that domain as well. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.havocinspired.co.uk/tutorial/plesk-pear-include_paths-open_basedir-and-media-temple/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>My &#8220;Create a fading nav effect&#8221; tutorial</title>
		<link>http://www.havocinspired.co.uk/this-site/my-create-a-fading-nav-effect-tutorial/</link>
		<comments>http://www.havocinspired.co.uk/this-site/my-create-a-fading-nav-effect-tutorial/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 23:19:11 +0000</pubDate>
		<dc:creator>Ryan Taylor</dc:creator>
				<category><![CDATA[.net Magazine]]></category>
		<category><![CDATA[This Site]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.havocinspired.co.uk/?p=510</guid>
		<description><![CDATA[About a month ago I blogged to let you guys know that I had written my <a href="http://www.havocinspired.co.uk/this-site/create-a-fading-nav-effect-in-net-magazine/">first tutorial for .net magazine</a> explaining how I achieved the fading effect on the navigation of this very website. Now that that issue has come off the shelves I can re-post the article hear for those of you who missed it...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Fthis-site%2Fmy-create-a-fading-nav-effect-tutorial%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Fthis-site%2Fmy-create-a-fading-nav-effect-tutorial%2F&amp;source=ryanhavoc&amp;style=normal&amp;service=TinyURL.com" height="61" width="50" /><br />
			</a>
		</div>
<p>About a month ago I blogged to let you guys know that I had written my <a href="http://www.havocinspired.co.uk/this-site/create-a-fading-nav-effect-in-net-magazine/">first tutorial for .net magazine</a> explaining how I achieved the fading effect on the navigation of this very website. Now that that issue has come off the shelves I can re-post the article hear for those of you who missed it&#8230;</p>
<p>And here it is:</p>
<div class="wp-caption aligncenter" style="width: 510px"><a href="http://farm3.static.flickr.com/2555/3932054607_2f0bbd8d06_o.jpg"><img title="Create a fading nav effect" src="http://farm3.static.flickr.com/2555/3932054607_bbb96a3fef.jpg" alt="Click the tutorial to link through to my Flickr account were you can view a larger version..." width="500" height="215" /></a><p class="wp-caption-text">Click the tutorial to link through to my Flickr account were you can view a larger version of the tutorial...</p></div>
<p style="text-align: center;"><a href="http://farm3.static.flickr.com/2555/3932054607_2f0bbd8d06_o.jpg">View a larger version of the tutorial</a></p>
<p>I hope you find it useful. I&#8217;ve had some great feedback so far and would love to know what you think of the technique so leave a comment! :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.havocinspired.co.uk/this-site/my-create-a-fading-nav-effect-tutorial/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Create a fading nav effect in .net magazine</title>
		<link>http://www.havocinspired.co.uk/this-site/create-a-fading-nav-effect-in-net-magazine/</link>
		<comments>http://www.havocinspired.co.uk/this-site/create-a-fading-nav-effect-in-net-magazine/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 19:39:29 +0000</pubDate>
		<dc:creator>Ryan Taylor</dc:creator>
				<category><![CDATA[.net Magazine]]></category>
		<category><![CDATA[This Site]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.havocinspired.co.uk/?p=453</guid>
		<description><![CDATA[This months issue of <a href="http://www.netmag.co.uk/">.net magazine</a> features a tutorial that I have written on how to achieve the fading navigation effect I use on this very website.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Fthis-site%2Fcreate-a-fading-nav-effect-in-net-magazine%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Fthis-site%2Fcreate-a-fading-nav-effect-in-net-magazine%2F&amp;source=ryanhavoc&amp;style=normal&amp;service=TinyURL.com" height="61" width="50" /><br />
			</a>
		</div>
<p>This months issue of <a href="http://www.netmag.co.uk/">.net magazine</a> features a tutorial that I have written on how to achieve the fading navigation effect I use on this very website.</p>
<p>Since the launch of <a href="http://www.havocinspired.co.uk/web-design/launching-havoc-inspired-v3/">Havoc Inspired v3</a> I&#8217;ve had a lot of people asking me how it is done however Dan Oliver (Editor of .net Magazine) beat you all too it and asked me to write the 3-page tutorial for their August issue.</p>
<div id="attachment_457" class="wp-caption aligncenter" style="width: 260px"><a href="http://www.havocinspired.co.uk/wp-content/uploads/2009/08/net-issue-193.jpg"><img class="size-full wp-image-457" title="net-issue-193" src="http://www.havocinspired.co.uk/wp-content/uploads/2009/08/net-issue-193.jpg" alt=".net Magazine Issue 193" width="250" height="323" /></a><p class="wp-caption-text">.net Magazine Issue 193</p></div>
<p>I really enjoyed the experience of writing for .net. The guys do an awesome job with the magazine every month and if my tutorial isn&#8217;t reason enough for you to go buy a copy there&#8217;s also a great feature by Elliot Jay Stocks entitled &#8220;Become a one man web agency&#8221;, a Q&#038;A with Khoi Vinh from NYTimes.com, an interview with Irene Au from Google and lots more!</p>
<p>I&#8217;ve also been told that I can release the tutorial myself once the issue comes off the shelves so for those of you who can&#8217;t get .net, keep an eye out for that in about a month.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.havocinspired.co.uk/this-site/create-a-fading-nav-effect-in-net-magazine/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Screencast: Quick PHP Form Validation with PEAR</title>
		<link>http://www.havocinspired.co.uk/tutorial/screencast-quick-php-form-validation-with-pear/</link>
		<comments>http://www.havocinspired.co.uk/tutorial/screencast-quick-php-form-validation-with-pear/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 13:48:38 +0000</pubDate>
		<dc:creator>Ryan Taylor</dc:creator>
				<category><![CDATA[PEAR]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Screencast]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.havocinspired.co.uk/?p=23</guid>
		<description><![CDATA[I quite enjoy writing tutorials, however they are quite time consuming, so I thought I'd give screencasting a try. See what you think of my tutorial on PHP form validation using the PEAR package Validate.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Ftutorial%2Fscreencast-quick-php-form-validation-with-pear%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Ftutorial%2Fscreencast-quick-php-form-validation-with-pear%2F&amp;source=ryanhavoc&amp;style=normal&amp;service=TinyURL.com" height="61" width="50" /><br />
			</a>
		</div>
<p><object width="500" height="380" data="http://vimeo.com/moogaloop.swf?clip_id=1671409&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=1671409&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /></object></p>
<p><em>Note: I hope the quality is manageable. If I do another screencast I&#8217;ll be working on improving it.</em></p>
<p>You can download the script I wrote in this tutorial <a href="http://www.havocinspired.co.uk//files/pear_validate_form.zip">from here</a>.</p>
<h2>Links</h2>
<p><strong>PEAR Website</strong> &#8211; <a href="http://pear.php.net/">http://pear.php.net/</a></p>
<p><strong>PEAR go-pear Script</strong> &#8211; <a href="http://pear.php.net/go-pear">http://pear.php.net/go-pear</a></p>
<p><strong>PEAR Validate Package</strong> &#8211; <a href="http://pear.php.net/package/Validate">http://pear.php.net/package/Validate</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.havocinspired.co.uk/tutorial/screencast-quick-php-form-validation-with-pear/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Work around for MT Comments CGI with PHP</title>
		<link>http://www.havocinspired.co.uk/movable-type/work-around-for-mt-comments-cgi-with-php/</link>
		<comments>http://www.havocinspired.co.uk/movable-type/work-around-for-mt-comments-cgi-with-php/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 11:00:33 +0000</pubDate>
		<dc:creator>Ryan Taylor</dc:creator>
				<category><![CDATA[Movable Type]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.havocinspired.co.uk/?p=13</guid>
		<description><![CDATA[The blog engine I use for this site is Movable Type, it's very flexible and scalable and meets my needs quite nicely. I did however hit a few problems when integrating it, specifically with comments. In this blog I share my solution to the problem I had.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Fmovable-type%2Fwork-around-for-mt-comments-cgi-with-php%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.havocinspired.co.uk%2Fmovable-type%2Fwork-around-for-mt-comments-cgi-with-php%2F&amp;source=ryanhavoc&amp;style=normal&amp;service=TinyURL.com" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://www.movabletype.org/">Movable Type</a> is built using <a href="http://www.perl.org/">Perl</a> and for the most part that is fine, its logic (Perl) is well separated from its presentation (HTML).</p>
<p><abbr title="Movable Type">MT</abbr> allows you to specify what extension files are published as, so as is the case for this site, I specified <a href="http://www.php.net">PHP</a>. PHP is the language I know, and I use various includes throughout the site as well as a few other scripts such as <a href="http://www.phpflickr.com">phpFlickr</a> to generate my Flickr stream.</p>
<p>The only problem I came across when integrating MT into this site was with two scripts in particular.</p>
<ul>
<li><a href="http://wiki.movabletype.org/Comment_Response">Comments Response</a> &#8211; mt-comments.cgi</li>
<li><a href="http://wiki.movabletype.org/Search_Results">Search Results</a> &#8211; mt-search.cgi</li>
</ul>
<p>You can change the HTML for these &#8220;elements&#8221; through the MT <strong>System Templates</strong> section. Problems arise when you try and integrate these “elements” into a PHP page.</p>
<h2>mt-search.cgi Problem</h2>
<p>I&#8217;ll start with mt-search.cgi because it was the easiest to fix, mainly because I didn&#8217;t have to think of a solution. <a href="http://www.shauninman.com/">Shaun Inman</a> already had, and his article on the matter can be <a href="http://www.shauninman.com/archive/2004/01/31/mt_search_and_php_includes">found here</a>.</p>
<p>To summarise, both mt-comments.cgi and mt-search.cgi are passed variables and return a result. However they don&#8217;t return the result as a variable passed to the template engine. They return them directly from the CGI script i.e. they generate the result directly through the CGI and CGI and PHP don&#8217;t mix.</p>
<p>I won&#8217;t repeat what Shaun has already written so take a look at his article (it&#8217;s not very long).</p>
<p>There was just one other addition I made to his solution. For some reason the mt-search.cgi script has a 60 second timer between searches and I kept getting an error message along the lines of “error, search is already in progress”. I fixed this simply by adding the following line into mt-config.cgi file:<br />
<code> </code></p>
<pre>ThrottleSeconds 1</pre>
<p>This sets the timer to 1 second and seems to have alleviated that issue.</p>
<h2>mt-comments.cgi Problem</h2>
<p>My big problem was with mt-comments.cgi and unfortunately I couldn&#8217;t find a solution through Google. So I had to actually sit and think about it.</p>
<p>The problem arises when a visitor submits a comment. By default the comment form POSTs the submitted variables to mt-comments.cgi. mt-comments.cgi then processes the submission and displays the results, typically a success or failure. Because the script itself returns the result, and obviously the script is Perl, you cannot have any PHP code as well. In my case this meant no includes, no Flickr stream etc. Clearly a problem.</p>
<p>Initially you would think that Shaun Inman&#8217;s solution for the search script would be the logical solution however, Shaun&#8217;s solution assumes that the script is expecting GET variables, i.e. variables appended to the end of the URL. The comments script however is expecting POST variables. So appending the variables to the end of the URL throws up an error. His solution won&#8217;t work here.</p>
<h2>My Solution</h2>
<p>To fix this problem we need the comments form to POST to a PHP page and for the PHP page to re-POST the variables to the mt-comments.cgi script. The mt-comments.cgi script will them return it results to the PHP script and we can display those results through PHP.</p>
<h3>Step 1</h3>
<p>To facilitate the re-POSTing of the variable we are going to use a <a href="http://pear.php.net">PEAR</a> package called <a href="http://pear.php.net/package/HTTP_Request">HTTP_Request</a>. A lot of hosting providers already have PEAR packages install, if you have a cPanel there is usually a link that tells you what packages are already installed for you.</p>
<p>If not you can download and install the package locally within your site but that is beyond the scope of this tutorial. Visit <a href="http://pear.php.net">pear.php.net</a> for details of how to do this.</p>
<p>Assuming you have HTTP_Request installed let&#8217;s continue.</p>
<p>Create a new template in MT under the <strong>Index Templates</strong>, and set its to <strong>Output File</strong> to be <strong>comments.php</strong>. Add in whatever HTML you want to make the template fall inline with the rest of your site.</p>
<p>Where your want the <strong>Comment Response</strong> message to appear add the following code:</p>
<pre class="brush: php;">&lt;?php
require_once &quot;HTTP/Request.php&quot;;
$req = new HTTP_Request(&quot;http://www.yoursite.co.uk/cgi-bin/mt/mt-comments.cgi&quot;);
$req-&gt;setMethod(HTTP_REQUEST_METHOD_POST);
$req-&gt;addPostData(&quot;author&quot;, $_POST['author']);
$req-&gt;addPostData(&quot;email&quot;, $_POST['email']);
$req-&gt;addPostData(&quot;url&quot;, $_POST['url']);
$req-&gt;addPostData(&quot;text&quot;, stripslashes($_POST['text']));
$req-&gt;addPostData(&quot;post&quot;, $_POST['post']);
$req-&gt;addPostData(&quot;static&quot;, $_POST['static']);
$req-&gt;addPostData(&quot;entry_id&quot;, $_POST['entry_id']);
$req-&gt;addPostData(&quot;__lang&quot;, $_POST['__lang']);
if(!PEAR::isError($req-&gt;sendRequest())){
     echo $req-&gt;getResponseBody();
}
?&gt;</pre>
<p>Looking through this code you can see that we include the HTTP_Request package. Then create a new object which points at the mt-comments.cgi file. We set the method to POST because we want to POST the variables to the mt-comments.cgi, and then we add the POST variables.</p>
<p>Remember we are going to POST to comments.php instead of directly to mt-comments.cgi.</p>
<p>Finally the if statement is just some error checking to make sure everything went ok.</p>
<h3>Step 2</h3>
<p>Find the <strong>Comment Form</strong> template under the <strong>Template Modules</strong> section.</p>
<p>Change the form action to point to the new file you created, e.g. <strong>http://www.yoursite.com/comments.php</strong>. And that should be it.</p>
<p>Publish your site and try leaving a comment. You can now use PHP within your comments.php file with no conflicts.</p>
<h2>Conclusion</h2>
<p>I&#8217;m not saying this is the best solution to this problem. It&#8217;s just one that has worked for me. If anyone has a better way of fixing this I would be interested to know what it is.</p>
<p>Hope this helps. Let me know your thoughts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.havocinspired.co.uk/movable-type/work-around-for-mt-comments-cgi-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
