<?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>Bin-Blog &#187; PHP</title>
	<atom:link href="http://www.bin-co.com/blog/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bin-co.com/blog</link>
	<description>Learn about the latest in Web Development - as soon as I do.</description>
	<lastBuildDate>Tue, 13 Oct 2009 18:55:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Plugin Week 2: WordPress Plugin &#8211; Weather Man</title>
		<link>http://www.bin-co.com/blog/2009/07/plugin-week-2-wordpress-plugin-weather-man/</link>
		<comments>http://www.bin-co.com/blog/2009/07/plugin-week-2-wordpress-plugin-weather-man/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 16:58:54 +0000</pubDate>
		<dc:creator>Binny V A</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugin-week-2]]></category>
		<category><![CDATA[weather]]></category>
		<category><![CDATA[weather-man]]></category>
		<category><![CDATA[wp]]></category>
		<category><![CDATA[wp-plugin]]></category>

		<guid isPermaLink="false">http://www.bin-co.com/blog/?p=294</guid>
		<description><![CDATA[After the success of <a href="http://www.bin-co.com/blog/2008/12/wordpress-plugin-week/">Plugin Week</a>, I have decided to do it once again. So, without further ado, <strong class="highlight">Welcome to Plugin Week 2</strong>. If you don't know what a plugin week is, its <strong class="highlight">a week when I publish one plugin per day - for an entire week</strong>.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2009/07/wordpressplugin.gif" alt="Wordpress Plugin" title="Wordpress Plugin" width="180" height="130" class="aligncenter size-full wp-image-297 intro" align="right" /></p>
<p class="intro">After the success of <a href="http://www.bin-co.com/blog/2008/12/wordpress-plugin-week/">Plugin Week</a>, I have decided to do it once again. So, without further ado, <strong class="highlight">Welcome to Plugin Week 2</strong>. If you don&#8217;t know what a plugin week is, its <strong class="highlight">a week when I publish one plugin per day &#8211; for an entire week</strong>.</p>
<p>There is one big difference between Plugin Week 1 and Plugin Week 2. In Plugin Week 1, only wordpress plugins where release(they are <a href="http://www.bin-co.com/blog/2008/11/eventr-wordpress-plugin/">Eventr</a>, <a href="http://www.bin-co.com/blog/2008/11/autofields-wordpress-plugin/">Autofields</a>, <a href="http://www.bin-co.com/blog/2008/11/pollin-wordpress-plugin/">Pollin</a>, <a href="http://www.bin-co.com/blog/2008/11/surveys-wordpress-plugin/">Surveys</a>, <a href="http://www.bin-co.com/blog/2008/11/quartz-wordpress-plugin/">Quartz</a> and <a href="http://www.bin-co.com/blog/2008/11/quizzin-wordpress-plugin/">Quizzin</a>). This time around, I will <strong class="highlight">not restrict myself to WordPress plugins</strong> &#8211; I&#8217;m going for other software too &#8211; expect Drupal plugins, jQuery plugins and more.</p>
<p>I&#8217;ll start off with a very simple plugin&#8230;</p>
<h2>Weather Man WordPress Plugin</h2>
<p><a href="http://www.bin-co.com/tools/wordpress/plugins/weather-man/">Weather Man</a> <strong class="highlight">shows the weather as a widget</strong> in the sidebar. You can add the widget using the Widget page under Appearance. Or you can add it in a post using the [weather-man] shortcode anywhere in the post. It uses Yahoo&#8217;s Weather API.</p>
<h3><a href="http://downloads.wordpress.org/plugin/weather-man.zip">Download Plugin</a></h3>
<p><a href="http://wordpress.binnyva.com/plugin/weather-man-plugin-test/">Demo of Weather Man WordPress Plugin</a></p>
<h3>Installation</h3>
<ul>
<li>Download the <a href="http://downloads.wordpress.org/plugin/weather-man.zip">zipped file</a>.</li>
<li>Extract and upload the contents of the folder to /wp-contents/plugins/ folder</li>
<li>Go to the Plugin management page of WordPress admin section and enable the &#8216;Weather Man&#8217; plugin</li>
<li>Go to the Widget configuration(under Appearance) and add the Weather Man Widget into any sidebar.</li>
<li>Alternatively, you can add the [weather-man] tag in any post and the Weather Man Widget will show up there.</li>
</ul>
<h3>Screenshots</h3>
<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2009/07/before.png" alt="Weather Form" title="Weather Form" width="318" height="131" class="aligncenter size-full wp-image-296" /></p>
<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2009/07/after.png" alt="Weather Display" title="Weather Display" width="378" height="321" class="aligncenter size-full wp-image-295" /></p>
<h3>Feedback</h3>
<p>If you have any suggestions or notice any problems with the plugin, post it in the <a href="http://projects.binnyva.com/forum/viewforum.php?f=16">Weather Man Plugin forum</a>.</p>
<h2>About Me and Plugin Week</h2>
<p>If you are new to this blog(I hope to get many new visitors due to the Plugin Week), <strong class="highlight">I&#8217;m Binny. I&#8217;m a freelance web developer on the LAMP platform</strong>. I specialize in PHP and <a href="http://www.openjs.com/">JavaScript</a>. More about me on my <a href="http://binnyva.com/">personal site</a>. Plugin Week 2 is an initiative to force myself to a small deadline to write code. It worked great during Plugin Week 1 &#8211; so I&#8217;m doing it again. Also, I get a lot of visitors during the Plugin Week <img src='http://www.bin-co.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  &#8211; that can&#8217;t be bad.</p>
<p>If you want to get news about the upcoming plugin releases(remember, 1 per day), please <strong class="highlight"><a href="http://feeds2.feedburner.com/bin-blog">subscribe to this site</a></strong>.</p>
<p>If you like the concept of the Plugin Week or if you found it helpful, <strong class="highlight">consider writing a post about Plugin Week on your blog</strong>. If you write a post, please let me know &#8211; and I&#8217;ll list your post on the last day of the plugin week(it will have a &#8216;Thank You for your Support&#8217; section).</p>
<p>Next plugin will be released tomorrow.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bin-co.com/blog/2009/07/plugin-week-2-wordpress-plugin-weather-man/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>A Tweet This Button for Each Post in WordPress &#8211; Without a Plugin</title>
		<link>http://www.bin-co.com/blog/2009/06/a-tweet-this-button-for-each-post-in-wordpress-without-out-a-plugin/</link>
		<comments>http://www.bin-co.com/blog/2009/06/a-tweet-this-button-for-each-post-in-wordpress-without-out-a-plugin/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 18:20:44 +0000</pubDate>
		<dc:creator>Binny V A</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[plugin-killer]]></category>
		<category><![CDATA[series]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.bin-co.com/blog/?p=275</guid>
		<description><![CDATA[<a href="http://richardxthripp.thripp.com/tweet-this">TweetThis</a> is a WordPress Plugin that 'adds a Twitter link to every post and page, so your readers can share your blog entries on their Twitter accounts with ease.' And in the tradition of my <a href="http://www.bin-co.com/blog/2009/03/wordpress-plugin-killer-series/">WordPress Plugin Killer Series</a>, this post will show you how to do it without a plugin.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2009/03/wordpress.jpg" alt="WordPress Metal Logo" title="WordPress Metal Logo" width="300" height="300" class="aligncenter size-full wp-image-239 intro" align="right" /></p>
<p class="intro"><a href="http://richardxthripp.thripp.com/tweet-this">TweetThis</a> is a WordPress Plugin that &#8216;adds a Twitter link to every post and page, so your readers can share your blog entries on their Twitter accounts with ease.&#8217; And in the tradition of my <a href="http://www.bin-co.com/blog/2009/03/wordpress-plugin-killer-series/">WordPress Plugin Killer Series</a>, this post will show you how to do it without a plugin.</p>
<h2>The Code</h2>
<p>You can <strong class="highlight">add twitter button to your post by editing the <code>single.php</code></strong> file in your theme. Go to the place in the file where you want the button to show up &#8211; then add this code at that location&#8230;</p>
<pre><code class="javascript">&lt;a href="http://twitter.com/?status=&lt;?php echo urlencode(the_title('','', false)) ?&gt;+-+&lt;?php the_permalink() ?&gt;"&gt;Tweet This&lt;/a&gt;</code></pre>
<p>This is a super simple way of doing it &#8211; <strong class="highlight">with a little more code, you can use a URL shortner</strong> to &#8217;shortify&#8217; your permalink. Otherwise it might overflow the 140 char limit.</p>
<h2>Twitter</h2>
<p>By the way, if you are on twitter, add me &#8211; I&#8217;m <a href="http://twitter.com/binnyva">@binnyva</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bin-co.com/blog/2009/06/a-tweet-this-button-for-each-post-in-wordpress-without-out-a-plugin/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Show Related Post in WordPress Without a Plugin</title>
		<link>http://www.bin-co.com/blog/2009/04/show-related-post-in-wordpress-without-a-plugin/</link>
		<comments>http://www.bin-co.com/blog/2009/04/show-related-post-in-wordpress-without-a-plugin/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 18:00:29 +0000</pubDate>
		<dc:creator>Binny V A</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugin-killer]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[related]]></category>
		<category><![CDATA[series]]></category>

		<guid isPermaLink="false">http://www.bin-co.com/blog/?p=256</guid>
		<description><![CDATA[Related posts is a very popular feature. My default wordpress installation often includes a plugin that has this functionality. There are quite a few plugins that lets you have this feature.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2009/03/wordpress-150x150.jpg" alt="WordPress Metal Logo" title="WordPress Metal Logo" width="150" height="150" class="alignnone size-full wp-image-239 intro" align="right" /></p>
<p class="intro">Related posts is a very popular feature. My default wordpress installation often includes a plugin that has this functionality. There are quite a few plugins that lets you have this feature&#8230;</p>
<ul>
<li><a href="http://mitcho.com/code/yarpp/">Yet Another Related Posts Plugin (YARPP)</a></li>
<li><a href="http://rmarsh.com/plugins/similar-posts/">Similar Posts</a></li>
<li><a href="http://blendworx.com/aizattos-related-posts-wordpress-plugin/">Aizattos Related Posts</a></li>
<li><a href="http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/">WordPress Related Posts</a></li>
<li><a href="http://wasabi.pbwiki.com/Related%20Entries">Wasabi Related entries</a></li>
</ul>
<h2>The Code</h2>
<p>WordPress has been supporting tags in its new released &#8211; so the related posts feature can be implemented without the help of any plugins. All we have to do is find the <strong>other posts with some same tags as the current post</strong>. Just open the <strong><code>single.php</code> file in your theme and add this bit of code</strong> where you want the related posts to show up&#8230;</p>
<pre><code class="php">&lt;?php
$tags = wp_get_post_tags($post-&gt;ID);
if ($tags) {
	$tag_ids = array();
	foreach($tags as $individual_tag) $tag_ids[] = $individual_tag-&gt;term_id;

	$args=array(
		'tag__in' =&gt; $tag_ids,
		'post__not_in' =&gt; array($post-&gt;ID),
		'showposts'=&gt;5, // Number of related posts that will be shown.
		'caller_get_posts'=&gt;1
	);
	$my_query = new wp_query($args);
	if( $my_query-&gt;have_posts() ) {
		echo '&lt;h3&gt;Related Posts&lt;/h3&gt;&lt;ul&gt;';
		while ($my_query-&gt;have_posts()) {
			$my_query-&gt;the_post();
		?&gt;
			&lt;li&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark" title="Permanent Link to &lt;?php the_title_attribute(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;
		&lt;?php
		}
		echo '&lt;/ul&gt;';
	}
}
?&gt;</code></pre>
<p>This code finds the other post with any one of the tag that the current post has. If you want to show the <strong>posts with any one of the categories</strong> that the current post has, use this code instead&#8230;</p>
<pre><code class="php">&lt;?php
$categories = get_the_category($post-&gt;ID);
if ($categories) {
	$category_ids = array();
	foreach($categories as $individual_category) $category_ids[] = $individual_category-&gt;term_id;

	$args=array(
		'category__in' =&gt; $category_ids,
		'post__not_in' =&gt; array($post-&gt;ID),
		'showposts'=&gt;5, // Number of related posts that will be shown.
		'caller_get_posts'=&gt;1
	);
	// Rest is the same as the previous code
</code></pre>
<h2>WordPress Plugin Killer Series</h2>
<p>For those who came in late, this post is part of the <a href="http://www.bin-co.com/blog/2009/03/wordpress-plugin-killer-series/">WordPress Plugin Killer Series</a>. This series will show you how to duplicate the functionality of the a few wordpress plugins without having to install it using custom code in the wordpress theme. The previous posts in this series are&#8230;</p>
<ul>
<li><a href="http://www.bin-co.com/blog/2009/02/avoid-duplicate-content-use-canonical-url-in-wordpress-fix-plugin/">Avoid Duplicate Content &#8211; Use Canonical URL in WordPress</a></li>
<li><a href="http://www.bin-co.com/blog/2009/03/show-popular-posts-in-wordpress-without-a-plugin/">Show Popular Posts in WordPress &#8211; without a plugin</a></li>
<li><a href="http://www.bin-co.com/blog/2009/03/adding-social-bookmarking-button-in-wordpress-without-plugins/">Adding Social Bookmarking Button in WordPress &#8211; Without Plugins</a></li>
</ul>
<h3>More Resources</h3>
<ul>
<li><a href="http://www.smashingmagazine.com/2009/04/15/10-exceptional-wordpress-hacks/">10 Exceptional WordPress Hacks</a></li>
<li><a href="http://www.wprecipes.com/how-to-show-related-posts-without-a-plugin">How to: Show related posts without a plugin</a></li>
]]></content:encoded>
			<wfw:commentRss>http://www.bin-co.com/blog/2009/04/show-related-post-in-wordpress-without-a-plugin/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
		</item>
		<item>
		<title>Adding Social Bookmarking Button in WordPress &#8211; Without Plugins</title>
		<link>http://www.bin-co.com/blog/2009/03/adding-social-bookmarking-button-in-wordpress-without-plugins/</link>
		<comments>http://www.bin-co.com/blog/2009/03/adding-social-bookmarking-button-in-wordpress-without-plugins/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 17:48:19 +0000</pubDate>
		<dc:creator>Binny V A</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[bookmarking]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugin-killer]]></category>
		<category><![CDATA[social]]></category>

		<guid isPermaLink="false">http://www.bin-co.com/blog/?p=245</guid>
		<description><![CDATA[Many blogs have links to add the current post to various social bookmarking site like Digg, Reddit, Delicious, etc. This blog don't have it - but my <a href="http://lindesk.com/" title="Linux - on the Desktop">LinDesk blog</a> does.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2009/03/social_bookmarking.png" alt="Social Bookmarking" title="Social Bookmarking" width="148" height="136" class="alignnone size-full wp-image-244 intro" align="right" /></p>
<p class="intro">Many blogs have links to add the current post to various social bookmarking site like Digg, Reddit, Delicious, etc. This blog don&#8217;t have it &#8211; but my <a href="http://lindesk.com/" title="Linux - on the Desktop">LinDesk blog</a> does. This effect is achieved using wordpress plugins like&#8230;</p>
<ul>
<li><a href="http://blog.rswr.net/2009/02/14/social-media-wordpress-plugin/">S-ButtonZ Social Media Buttons &#8211; WordPress Plugin</a></li>
<li><a href="http://wordpress.org/extend/plugins/social-buttons/">WordPress › Social Buttons</a></li>
<li><a href="http://yoast.com/wordpress/sociable/">Sociable &#8211; Social Bookmarking for WordPress</a></li>
<li><a href="http://andybeard.eu/wordpress-plugin-hacks">Hacked Wordpress Plugins</a></li>
<li><a href="http://lipidity.com/web/wordpress/wp-plugin-gregarious/">WP Plugin: Gregarious</a></li>
<li><a href="http://www.milienzo.com/wordpress-plugins/i-love-social-bookmarking/">I Love Social Bookmarking plugin</a></li>
<li><a href="http://wordpress.org/extend/plugins/add-to-any/">WordPress › Add to Any Share/Save/Bookmark Button</a></li>
</ul>
<p>For those who are new, this is part three of the <a href="http://www.bin-co.com/blog/2009/03/wordpress-plugin-killer-series/">Plugin Killer series</a>. This series will show you how to duplicate the functionality of the a few wordpress plugins without having to install it using custom code in the wordpress theme. The earlier posts in this series are&#8230;</p>
<ul>
<li><a href="http://www.bin-co.com/blog/2009/02/avoid-duplicate-content-use-canonical-url-in-wordpress-fix-plugin/">Avoid Duplicate Content &#8211; Use Canonical URL in WordPress</a></li>
<li><a href="http://www.bin-co.com/blog/2009/03/show-popular-posts-in-wordpress-without-a-plugin/">Show Popular Posts in WordPress &#8211; without a plugin</a></li>
</ul>
<h2>The Code</h2>
<p>You can add social bookmarking button to your post by editing the <strong class="highlight"><code>single.php</code> file in your theme</strong>. Go to the place in the file where you want the buttons to show up &#8211; then add this code at that location&#8230;</p>
<pre><code class="html">&lt;a href="http://del.icio.us/post?url=&lt;?php the_permalink() ?&gt;&amp;title=&lt;?php echo urlencode(the_title('','', false)) ?&gt;"&gt;del.icio.us&lt;/a&gt;
 | &lt;a href="http://digg.com/submit?phase=2&amp;url=&lt;?php the_permalink() ?&gt;"&gt;Digg it&lt;/a&gt;
 | &lt;a href="http://reddit.com/submit?url=&lt;?php the_permalink() ?&gt;&amp;title=&lt;?php echo urlencode(the_title('','', false)) ?&gt;"&gt;reddit&lt;/a&gt;
 | &lt;a href="http://www.stumbleupon.com/submit?url=&lt;?php the_permalink() ?&gt;&amp;title=&lt;?php echo urlencode(the_title('','', false)) ?&gt;"&gt;StumbleUpon&lt;/a&gt;
</code></pre>
<p>Of course, you don&#8217;t have to do it like that &#8211; a better way of doing it is by putting the links in a li/ul list and then styling it. The point is, you don&#8217;t need a plugin to do this.</p>
<h2>Different Implementations</h2>
<p>Another thing I would recommend is get the images &#8211; in the above code, I just used text links. If you get the favicons of the sites you&#8217;re linking to, it will look a lot nicer. <a href="http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/">Example</a> (go to the end of the post). You can use bigger images as well &#8211; <a href="http://aravindjose.com/blog/2009/01/30/the-sensible-way-of-making-money-online-and-building-a-career-with-online-video/" title="Make a living out of Videos on Web. Seriously.">example</a>. Or use some kind of effect &#8211; <a href="http://www.millionclues.com/blogosphere/blogging-tips-blogosphere/getting-quality-backlinks" title="Getting Quality Backlinks without Link Exchanges">example</a>(here the icons are a bit transparent by default &#8211; but when you hover over them, it shows up clearly &#8211; its completely opaque).</p>
<p>Here only the four big ones are given. You can find <a href="http://txt.binnyva.com/2007/02/submition-to-social-bookmarking-sites/">code for more social bookmarking sites</a> elsewhere.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bin-co.com/blog/2009/03/adding-social-bookmarking-button-in-wordpress-without-plugins/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Show Popular Posts in WordPress &#8211; without a plugin</title>
		<link>http://www.bin-co.com/blog/2009/03/show-popular-posts-in-wordpress-without-a-plugin/</link>
		<comments>http://www.bin-co.com/blog/2009/03/show-popular-posts-in-wordpress-without-a-plugin/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 18:27:20 +0000</pubDate>
		<dc:creator>Binny V A</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugin-killer]]></category>
		<category><![CDATA[popular]]></category>
		<category><![CDATA[series]]></category>
		<category><![CDATA[top]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://www.bin-co.com/blog/?p=240</guid>
		<description><![CDATA[A list of the popular posts of the blog is a standard feature in many blogs. There are quite a few plugins that offer this feature. In case you are new to this blog, I am currently working on the <a href="http://www.bin-co.com/blog/2009/03/wordpress-plugin-killer-series/">Plugin Killer Series</a> - a series of post in which I explain how to duplicate the functionality provided by some wordpress plugins - without having to install the plugin.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2009/03/halo_wordpress.jpg" alt="WordPress Helo Effect" title="WordPress Helo Effect" width="300" height="233" class="alignnone size-full wp-image-238 intro" align="right" /></p>
<p class="intro">A <strong class="highlight">list of the popular posts</strong> of the blog is a standard feature in many blogs. There are quite a few plugins that offer this feature&#8230;</p>
<ul>
<li><a href="http://ajaydsouza.com/wordpress/plugins/top-10/">Top 10 &#8211; A Page Counter and Popular Posts plugin for WordPress</a></li>
<li><a href="http://alexking.org/blog/2005/05/23/popularity-contest">Popularity Contest Plugin (beta)</a></li>
<li><a href="http://wordpress.org/extend/plugins/wordpress-popular-posts/">Wordpress Popular Posts</a></li>
<li><a href="http://boakes.org/most-wanted/">MostWanted &#8211; a Popular Posts Plugin for WordPress</a></li>
</ul>
<p>Now, lets see how to do it without using a plugin. In case you are new to this blog, I am currently working on the <a href="http://www.bin-co.com/blog/2009/03/wordpress-plugin-killer-series/">Plugin Killer Series</a> &#8211; a series of post in which I explain how to duplicate the functionality provided by some wordpress plugins &#8211; without having to install the plugin.</p>
<p>These <strong class="highlight">plugins work by adding a view counter for each post</strong> &#8211; whenever a user visits a page, it will increment the count for that page by one. Unfortunately, WordPress does not provide this feature. But there is <strong class="highlight">another indicator for the popularity of a post &#8211; its comment count</strong>.</p>
<h2>The Code</h2>
<h3>Getting Comment Count &#8211; SQL</h3>
<p>So the first step is to get the list of post with the most comments. To get that, we can use the following SQL statement&#8230;</p>
<pre><code class="sql">SELECT id,post_title FROM wp_posts ORDER BY comment_count DESC LIMIT 0,10</code></pre>
<h3>Listing The Data &#8211; PHP/SQL</h3>
<p>This query will return just 10 posts. If you want more(or less) post, just change the number after LIMIT accordingly. The PHP code for executing the query and getting its result is&#8230;</p>
<pre><code class="php">$popular_posts = $wpdb-&gt;get_results("SELECT id,post_title FROM {$wpdb-&gt;prefix}posts ORDER BY comment_count DESC LIMIT 0,10");
foreach($popular_posts as $post) {
	// Do something with the $post variable
}
</code></pre>
<h3>Final Output as Links in a List &#8211; HTML/PHP/SQL</h3>
<p>Next step is to get the URL of each post. The recommended way of doing this is by using the &#8216;<a href="http://codex.wordpress.org/Template_Tags/get_permalink">get_permalink</a>&#8216; function. Another thing we have to do is to map the result as an HTML list&#8230;</p>
<pre><code class="php">&lt;li&gt;&lt;h3&gt;Popular Posts&lt;/h3&gt;
&lt;ul class="bullets"&gt;
&lt;?php
$popular_posts = $wpdb-&gt;get_results("SELECT id,post_title FROM {$wpdb-&gt;prefix}posts ORDER BY comment_count DESC LIMIT 0,10");
foreach($popular_posts as $post) {
	print "&lt;li&gt;&lt;a href='". get_permalink($post-&gt;id) ."'&gt;".$post-&gt;post_title."&lt;/a&gt;&lt;/li&gt;\n";
}
?&gt;
&lt;/ul&gt;
&lt;/li&gt;</code></pre>
<p>Note: The HTML part of the code may need to be changed &#8211; depending on your theme.</p>
<p>Add this code to the <code>sidebar.php</code> file in your theme &#8211; and you are done!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bin-co.com/blog/2009/03/show-popular-posts-in-wordpress-without-a-plugin/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>WordPress Plugin Killer: The Series</title>
		<link>http://www.bin-co.com/blog/2009/03/wordpress-plugin-killer-series/</link>
		<comments>http://www.bin-co.com/blog/2009/03/wordpress-plugin-killer-series/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 18:15:35 +0000</pubDate>
		<dc:creator>Binny V A</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugin-killer]]></category>
		<category><![CDATA[series]]></category>

		<guid isPermaLink="false">http://www.bin-co.com/blog/?p=235</guid>
		<description><![CDATA[My <a href="http://www.bin-co.com/blog/2009/02/avoid-duplicate-content-use-canonical-url-in-wordpress-fix-plugin/">last post</a> about using a bit of custom PHP code in the wordpress template instead of installing a plugin inspired a new way of thinking for me. <strong class="highlight">How many of the wordpress plugins currently in use are actually necessary? Couldn't we avoid a few plugins by using a bit of custom code?</strong>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2009/03/wordpress-sticker.jpg" alt="WordPress Plugin Killer: The Series" title="Wordpress Sticker" width="300" height="282" class="alignnone size-full wp-image-236 intro" align="right" /></p>
<p class="intro">My <a href="http://www.bin-co.com/blog/2009/02/avoid-duplicate-content-use-canonical-url-in-wordpress-fix-plugin/">last post</a> about using a bit of custom PHP code in the wordpress template instead of installing a plugin inspired a new way of thinking for me. <strong class="highlight">How many of the wordpress plugins currently in use are actually necessary? Couldn&#8217;t we avoid a few plugins by using a bit of custom code?</strong></p>
<p>So I decided to do <strong class="highlight">a series on how to duplicate the functionality of some plugins</strong> using PHP code within the WordPress theme/template itself. That way, you can eliminate the plugin &#8211; and still get the features offered by the plugin.</p>
<h2>The Advantages</h2>
<p>The advantages of avoiding unnecessary plugins&#8230;</p>
<dl>
<dt>Less overhead/More Optimized Method</dt>
<dd>If you have installed a plugin, the plugin files must be read and loaded into the memory on every page load. This overhead can be avoided by using putting the code into the template file which is already in the include list.</dd>
<dt>Don&#8217;t have to worry about plugin updates</dt>
<dd>Granted, current WordPress version make it very easy to update plugins. But still, if you embed the code, then there is no need to update the code every month or so.</dd>
<dt>Much more customizable than the plugin</dt>
<dd>You can write the code to get the exact functionality you want. You cannot get that with a plugin.</dd>
<dt>You learn more about WordPress</dt>
<dd>This is perhaps the most important effect &#8211; you learn more about wordpress template tags, about PHP, about wordpress internals and lot more.</dd>
</dl>
<h2>The Disadvantages</h2>
<dl>
<dt>Not as easy as using a plugin</dt>
<dd>For those who work with WordPress and PHP code all the time, like myself, editing the code may be easier than finding, installing and configuring a new plugin. But for most normal people, using the plugin is a much easier option.</dd>
<dt>Have to be familiar with coding, PHP, FTP, etc.</dt>
<dd>To do custom coding, you have to be familiar with technologies like PHP, HTML, FTP uploading etc. If you are not familiar with these, you will have to put in a bit of time to learn it.</dd>
<dt>Changing the theme involves a lot of work.</dt>
<dd>You will have to port all the changes you made in your old theme to the new theme whenever you decide to move to the a theme. The more you customize a theme, the more time you have to spent when moving to a new theme.</dd>
</dl>
<h2>Plugin Killer Series</h2>
<p>With this in mind, I have decided to create a series that shows how to &#8216;kill&#8217; some unnecessary wordpress plugins. You will be able to get the same functionality by using the custom code in your template files.</p>
<p>The first post in this series is already done &#8211; it is the &#8216;<a href="http://www.bin-co.com/blog/2009/02/avoid-duplicate-content-use-canonical-url-in-wordpress-fix-plugin/">Avoid Duplicate Content &#8211; Use Canonical URL in WordPress</a>&#8216; where I showed how to create the same functionality as the <a href="http://yoast.com/wordpress/canonical/">Canonical plugin</a>.</p>
<p>More to follow. If you are interested in these posts, make sure you have subscribed to <a href="http://feeds2.feedburner.com/bin-blog">Bin-Blog Feed</a> &#8211; if you have not done so already.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bin-co.com/blog/2009/03/wordpress-plugin-killer-series/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>WordPress Plugin Week</title>
		<link>http://www.bin-co.com/blog/2008/12/wordpress-plugin-week/</link>
		<comments>http://www.bin-co.com/blog/2008/12/wordpress-plugin-week/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 18:24:05 +0000</pubDate>
		<dc:creator>Binny V A</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugin-week]]></category>
		<category><![CDATA[quartz]]></category>
		<category><![CDATA[quizzin]]></category>
		<category><![CDATA[surveys]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://www.bin-co.com/blog/?p=208</guid>
		<description><![CDATA[As my subscribers already know, the week before last was <strong class="highlight">Plugin Week - that's when I publish one WordPress plugin per day for one week</strong>. And I managed to pull it off too - there is a list of all the plugins released on that week...]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2008/10/wordpress_logo.png" alt="" title="WordPress Logo" width="183" height="145" class="alignnone size-full wp-image-136 intro" align="right" /></p>
<p class="intro">As my subscribers already know, the week before last was <strong class="highlight">Plugin Week &#8211; that&#8217;s when I publish one WordPress plugin per day for one week</strong>. And I managed to pull it off too &#8211; there is a list of all the plugins released on that week&#8230;</p>
<dl>
<dt><a href='http://www.bin-co.com/blog/2008/11/eventr-wordpress-plugin/'>Eventr Wordpress Plugin</a></dt>
<dd>
<p><a href="http://www.bin-co.com/tools/wordpress/plugins/eventr/">Eventr plugin</a> lets you use your blog as an event management tool. You can create an event &#8211; the plugin will let people sign up for the event &#8211; it can also show a list of all the attendees. Once the event is done, you can deactivate the event and no more signups will be allowed.</p>
</dd>
<dt><a href='http://www.bin-co.com/blog/2008/11/autofields-wordpress-plugin/'>Autofields WordPress Plugin</a></dt>
<dd>
<p><a href="http://www.bin-co.com/tools/wordpress/plugins/autofields/">AutoFields Plugin</a> will <strong class="highlight">auto fill the Excerpt and add an Image custom field based on the data you entered</strong> into the contents editor. This plugin will set the <strong class="highlight">first paragraph of the content as the excerpt</strong> and take the <strong class="highlight">first image(if there are any) and set it as the &#8216;Image&#8217; custom field</strong>(needed for some themes &#8211; like <a href="http://www.bin-co.com/blog/2008/10/new-design-mimbo-theme/">Mimbo &#8211; my theme</a>). When you hit the publish button, it will check to make sure that excerpt and Image custom fields are filled. If not, it will ask you to confirm before publishing the post.</p>
</dd>
<dt><a href='http://www.bin-co.com/blog/2008/11/pollin-wordpress-plugin/'>Pollin WordPress Plugin</a></dt>
<dd>
<p><strong class="highlight"><a href="http://www.bin-co.com/tools/wordpress/plugins/pollin/">Pollin wordpress plugin</a> will let you add polls</strong> to your blog. It can be shown to your <strong class="highlight">visitors who will be able to vote</strong> in the poll. You can add the poll in a post by including the HTML comment &#60;!&#8211; POLLIN 1 &#8211;&#62; in the post. Here 1 is the ID of the poll to be shown.</p>
</dd>
<dt><a href='http://www.bin-co.com/blog/2008/11/surveys-wordpress-plugin/'>Surveys WordPress Plugin</a></dt>
<dd>
<p>The <strong class="highlight"><a href="http://www.bin-co.com/tools/wordpress/plugins/surveys/">Surveys WordPress plugin</a> lets you add surveys to your blog</strong>. You can let the visitors take surveys and <strong class="highlight">see the result from the admin side</strong>. The user who take the survey can enter their details at the end of the survey &#8211; or leave it as an anonymous result.</p>
</dd>
<dt><a href='http://www.bin-co.com/blog/2008/11/quartz-wordpress-plugin/'>Quartz WordPress Plugin</a></dt>
<dd>
<p><strong class="highlight"><a href="http://www.bin-co.com/tools/wordpress/plugins/quartz/">Quartz Plugin</a> lets you show random quotes/tips/links/pictures/something else to visitors</strong>. These quotes can be added from the admin side. You can add these one by one &#8211; or you can bulk import the stuff from a text file.</p>
</dd>
<dt><a href='http://www.bin-co.com/blog/2008/11/quizzin-wordpress-plugin/'>Quizzin WordPress Plugin</a></dt>
<dd>
<p><strong class="highlight"><a href="http://www.bin-co.com/tools/wordpress/plugins/quizzin/">Quizzin WordPress Plugin</a> lets you add quizzes to your blog</strong>. This plugin is designed to be as easy to use as possible. Quizzes, questions and answers can be added from the admin side. This will appear in your post if you add a small HTML comment in your post.</p>
</dd>
</dl>
<h2>What I Learned</h2>
<h3>I am helpless without my frameworks</h3>
<p>After I releasing a beta version of my plugin, I got some feedback about those. To my great surprise, I found that I was making a lot of novice PHP mistakes &#8211; stuff like&#8230;</p>
<ul>
<li>not using escaping/validating user input</li>
<li>not using stripslashes</li>
<li>and more&#8230;</li>
</ul>
<p>Needless to say, it was very embarrassing. <strong class="highlight">In all my other applications, <a href="http://www.bin-co.com/php/scripts/iframe/" title="PHP Framework: iFrame">my framework</a> takes care of it</strong> automatically. When I am developing outside <a href="http://www.openjs.com/scripts/jslibrary/" title="My JavaScript Framework - JSL">my framework</a>, I feel like a fish out of water. Now I am slowly adapting to coding without the framework. But it will take more time to get fully used to it.</p>
<h3>I still have a lot to learn about WordPress plugin development</h3>
<p>I only found out about the <code>deltaSql()</code> function after the plugin week. This is a very useful function if you create a distributable web app(like <a href="http://nexty.org/">Nexty</a>). Only problem is that its GPL code &#8211; I am not sure if I can use it in my BSD application. Anyway, I found that function when I was trying to release an update to one of the plugins &#8211; after the plugin week. There is a lot of stuff I still have to learn about WP plugin development.</p>
<h3>Putting strict deadline to write code is not(always) a good thing.</h3>
<p>As I said earlier I made a lot of blunders when creating the plugins. One of the main reason was I was too used to my framework. The other reason was the deadline. It forced me to write some code that was not all that great. But then again, the deadline had its advantages too &#8211; I would not have written the plugins had I not been forced to do that due to the plugin week. In conclusion, <strong class="highlight">you get quantity &#8211; but not quality with deadlines</strong>.</p>
<h3>Learn a bit of Marketing &#8211; even if you are a programmer</h3>
<p>I used to scoff at articles like &#8216;<a href="http://www.codinghorror.com/blog/archives/001177.html">The One Thing Every Software Engineer Should Know [How to market]</a>&#8216; &#8211; but now I understand the rational behind that.</p>
<h3>Don&#8217;t release plugins just before a new WordPress version is going to be made</h3>
<p>I am sure <strong class="highlight">the next wordpress(2.7) will break a few of my plugins</strong>. In hindsight, I should have waited until that release was over before doing the plugin week. Because I did the plugin week before the release of WordPress 2.7, I&#8217;ll <strong class="highlight">have to do a Plugin Fix Week later &#8211; a week when I fix all my plugins for WordPress 2.7</strong> compactability <img src='http://www.bin-co.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<h3>WordPress suppresses errors by default.</h3>
<p>Something to keep in mind if you are developing a plugin &#8211; SQL errors are suppressed by default. I sent a lot of time trying to figure out the cause of an error before realizing it was an error in the SQL query. You can turn on SQL errors using the code <code>$wpdb->show_errors();</code>.</p>
<h2>Thanks for all your support&#8230;</h2>
<p>Quite a few people supported my effort by linking to me. This is my way of saying &#8216;Thank You&#8217;&#8230;</p>
<ul>
<li><a href="http://www.bloggingtips.com/2008/11/22/6-wordpress-plugins-week/">Binny Releases 6 WordPress Plugins In A Week</a></li>
<li><a href="http://www.offlineblog.net/2008/11/plugin-week-from-binny/">Plugin Week, from Binny</a></li>
<li><a href="http://www.theanand.com/blog/index.php/just-ripples/a-plugin-a-day/">A Plugin A Day!</a></li>
<li><a href="http://www.techzilo.com/wordpress-plugin-week-daily-launch/">Plugin Week promises a daily WordPress plugin for a week</a></li>
<li><a href="http://www.sajithmr.com/plugin-age/">Plugin Age</a></li>
<li><a href="http://aravindjose.com/blog/2008/11/19/five-insanely-useful-wordpress-plugins-released-in-5-days-by-binny/">A Wordpress Plugin A Day</a></li>
<li><a href="http://www.techzilo.com/blogging/plugin-week-wordpress-challenge/">Plugin Week &#8211; one WordPress plugin a day for a week</a></li>
<li><a href="http://blogdesignstudio.com/mini-blog/plugin-week-binny-is-on-plugin-development-rampage/">Plugin Week! Binny is on plugin development rampage</a></li>
</ul>
<p>If I have missed anyone, please add a comment with the link to the post where you talked about plugin week and I&#8217;ll add you to the list.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bin-co.com/blog/2008/12/wordpress-plugin-week/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Installing lighttpd Web Server in Linux with PHP and MySQL</title>
		<link>http://www.bin-co.com/blog/2008/11/installing-lighttpd-web-server-in-linux-with-php-and-mysql/</link>
		<comments>http://www.bin-co.com/blog/2008/11/installing-lighttpd-web-server-in-linux-with-php-and-mysql/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 17:48:21 +0000</pubDate>
		<dc:creator>Binny V A</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://www.bin-co.com/blog/?p=161</guid>
		<description><![CDATA[After <a href="http://www.bin-co.com/blog/2008/09/installing-lampapache-web-serverphpmysql-in-debian/" title="Installing LAMP(Apache Web Server/PHP/MySQL) in Debian">two articles</a> on <a href="http://www.bin-co.com/blog/2008/09/compile-install-lamp-linux-apache-mysql-php-server-from-source/" title="Compile and Install a LAMP(Linux/Apache/MySQL/PHP) Server from Source">installing Apache</a>, lets take a look at <strong class="highlight">installing and configuring lighttpd web server on a linux system</strong>. <a href="http://www.lighttpd.net/">lighttpd</a> (pronounced "lighty") is a web server designed to be secure, fast, standards-compliant and flexible while having a low memory footprint.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2008/11/lighttpd_logo.png" alt="lighttpd Web Server" title="Lighttpd Logo" width="200" height="197" class="alignnone size-full wp-image-160 intro" align="right" /></p>
<p class="intro">After <a href="http://www.bin-co.com/blog/2008/09/installing-lampapache-web-serverphpmysql-in-debian/" title="Installing LAMP(Apache Web Server/PHP/MySQL) in Debian">two articles</a> on <a href="http://www.bin-co.com/blog/2008/09/compile-install-lamp-linux-apache-mysql-php-server-from-source/" title="Compile and Install a LAMP(Linux/Apache/MySQL/PHP) Server from Source">installing Apache</a>, lets take a look at <strong class="highlight">installing and configuring lighttpd web server on a linux system</strong>. <a href="http://www.lighttpd.net/">lighttpd</a> (pronounced &#8220;lighty&#8221;) is a web server designed to be secure, fast, standards-compliant and flexible while having a low memory footprint.</p>
<p>Before installation, a few points to remember. These <strong class="highlight">instruction are not for a production environment &#8211; this is for a development environment</strong>. To install the software, <strong class="highlight">you need root access</strong>. You can get that using this command&#8230;</p>
<pre><code class="cli">su -
[Enter root password]</code></pre>
<p>or by prefixing &#8216;<code>sudo</code>&#8216; before each command.</p>
<h2>Installing the Server</h2>
<p>First install lighttpd and PHP &#8211; use your distro&#8217;s package management(yum, apt-get) system to do this.</p>
<h3>Install lighttpd</h3>
<p>You can use this command in Red Hat based systems(Fedora, Cent OS, etc.) to install lighttpd. Debian/Ubuntu systems might the same package name &#8211; could someone post the package name of lighttpd in the comments?</p>
<pre><code class="cli">yum install lighttpd lighttpd-fastcgi</code></pre>
<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2008/09/php-logo.png" alt="PHP Logo" title="PHP Logo" width="179" height="98" class="alignnone size-full wp-image-123" align="right" /></p>
<h3>Install PHP</h3>
<p>If you don&#8217;t have PHP, you can install it using the command&#8230;</p>
<pre><code class="cli">yum install php php-cli php-common</code></pre>
<p>In Debian/Ubuntu systems, the command is&#8230;</p>
<pre><code class="cli">apt-get install php5-cli php5-common php5-cgi</code></pre>
<p>You can make sure you have php-cgi(needed for working with lighttpd) by running this command&#8230;</p>
<pre><code class="cli">php-cgi -v</code></pre>
<h3>Installing MySQL</h3>
<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2008/09/mysql_logo.gif" alt="" title="MySQL Logo" width="150" height="98" class="alignnone size-full wp-image-127" align="right" /></p>
<p>If MySQL is not yet installed, use this command to install it&#8230;</p>
<pre><code class="cli">yum install mysql-server php-mysql mysql mysql-libs</code></pre>
<p>Debian/Ubuntu Command&#8230;</p>
<pre><code class="cli">apt-get install mysql-client mysql-common mysql-server php5-mysql</code></pre>
<h2>Configuring lighttpd</h2>
<p>lighttpd configuration is done by <strong class="highlight">editing the text file &#8216;/etc/lighttpd/lighttpd.conf&#8217;.</strong></p>
<p><strong class="highlight">Enable some lighttpd modules</strong> by removing the comment character(#) from the beginning of the line. I have enabled the following modules&#8230;</p>
<pre><code class="conf">server.modules              = (
                                "mod_rewrite",
                                "mod_redirect",
                                "mod_access",
                                "mod_fastcgi",
                                "mod_accesslog" )
</code></pre>
<p><strong class="highlight">Configure lighttpd&#8217;s document root</strong> &#8211; if you already have Apache, I would recommend using the same document root as Apache(applicable for development servers only). </p>
<pre><code class="conf">server.document-root        = "/var/www/"</code></pre>
<p>I find it helpful to <strong class="highlight">enable folder listing</strong> in my server.</p>
<pre><code class="conf">## virtual directory listings
dir-listing.activate       = "enable"</code></pre>
<h3>Turn On FastCGI PHP Support</h3>
<p>Now, make sure lighttpd works with PHP &#8211; first get the path of php-cgi using the command..</p>
<pre><code class="cli">$ whereis php-cgi
php-cgi: /usr/bin/php-cgi #Might be different on your system.</code></pre>
<p>Then <strong class="highlight">add the path to the configuration file</strong> of lighttpd&#8230;</p>
<pre><code class="conf">#### fastcgi module
## read fastcgi.txt for more info
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
fastcgi.server             = ( ".php" =>
                               ( "localhost" =>
                                 (
                                   "socket" => "/tmp/php.socket",
                                   <strong class="highlight">"bin-path" => "/usr/bin/php-cgi"</strong>
                                 )
                               )
                            )</code></pre>
<p>Make sure you <strong class="highlight">uncomment the above lines</strong> by removing the &#8216;#&#8217; characters.</p>
<p>After you are done, <strong class="highlight">save the file</strong>. Time to try out the server.</p>
<h2>Starting the lighttpd Server</h2>
<p>First stop Apache if it is running&#8230;</p>
<pre><code class="cli">/etc/init.d/httpd stop</code></pre>
<p>Now start lighttpd using the command</p>
<pre><code class="cli">/etc/init.d/lighttpd start</code></pre>
<p>Go to your document root(<code>/var/www</code>) and <strong class="highlight">create a php files called &#8216;info.php&#8217; and put this code</strong> inside it&#8230;</p>
<pre><code class="php">&lt;?php
php<!-- wordpress bug workaround -->Info();</code></pre>
<p>Now fire up a browser and <strong class="highlight">go to <a href="http://localhost/" title="Might not work if the preceding instructions where not followed">localhost</a></strong> &#8211; you should see a file listing page with a ‘info.php’ in the list. Click on that link &#8211; if you see a PHP information page, your web server is setup correctly.</p>
<p>To make sure MySQL-PHP connection is working, <a href="http://www.bin-co.com/database/clients/phpmyadmin/installing_phpmyadmin.php" title="Installing phpMyAdmin 2.8">install phpMyAdmin</a> &#8211; or write a database connection script &#8211; whatever is easier for you.</p>
<h2>Related Links</h2>
<ul>
<li><a href="http://www.lighttpd.net/">lighttpd fly light</a></li>
<li><a href="http://en.wikipedia.org/wiki/Lighttpd">lighttpd &#8211; Wikipedia</a></li>
<li><a href="http://cssgallery.info/lighttpd-install-perl-mysql-support-in-chrooted-jail/">Lighttpd install perl, mysql support in chrooted jail</a></li>
<li><a href="http://www.cyberciti.biz/tips/lighttpd-php-fastcgi-configuration.html">Lighttpd PHP fastcgi configuration</a></li>
<li><a href="http://www.cyberciti.biz/tips/howto-install-lighttpd-on-freebsd.html">FreeBSD Install Lighttpd Web Server</a></li>
<li><a href="http://fandar-it.com/content/view/35/32/">Install lighttpd with php</a></li>
<li><a href="http://wiki.vpslink.com/Install_and_Configure_lighttpd">Install and Configure lighttpd</a></li>
<li><a href="http://www.howtoforge.com/lighttpd_php5_mysql_fedora7">Installing Lighttpd With PHP5 And MySQL Support On Fedora 7</a></li>
</ul>
<p><strong class="highlight">Shameless Plug</strong>: If you are a Linux user, you may want to check out my <a href="http://lindesk.com/" title="Lindesk - Linux on the Desktop">Linux Blog &#8211; LinDesk</a> &#8211; its about Linux on the Desktop &#8211; Articles, Application Reviews and Tutorials about many aspects of Linux included configuration and scripting.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bin-co.com/blog/2008/11/installing-lighttpd-web-server-in-linux-with-php-and-mysql/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Remote Database Backup WordPress Plugin</title>
		<link>http://www.bin-co.com/blog/2008/10/remote-database-backup-wordpress-plugin/</link>
		<comments>http://www.bin-co.com/blog/2008/10/remote-database-backup-wordpress-plugin/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 16:43:10 +0000</pubDate>
		<dc:creator>Binny V A</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.bin-co.com/blog/?p=135</guid>
		<description><![CDATA[My second WordPress Plugin - <a href="http://www.bin-co.com/tools/wordpress/plugins/db_backup/">Remote Database Backup</a>. Its is based on the <a href="http://www.ilfilosofo.com/blog/wp-db-backup">WordPress Database Backup plugin</a>. If you are a regular wordpress user, you might be better off using WordPress Database Backup plugin instead of my version. But if you, like me, have a local server on your system and has a copy of your site on the local server as well as the online server, you will find great use for my plugin.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2008/10/wordpress_logo.png" alt="" title="Wordpress Logo" width="183" height="145" class="alignnone size-full wp-image-136 intro" align="right" /></p>
<p class="intro">I have released my second WordPress Plugin &#8211; <a href="http://www.bin-co.com/tools/wordpress/plugins/db_backup/">Remote Database Backup</a>. Its is based on the <a href="http://www.ilfilosofo.com/blog/wp-db-backup">WordPress Database Backup plugin</a>. If you are a regular wordpress user, you might be better off using WordPress Database Backup plugin instead of my version. But if you, like me, have a local server on your system and has a copy of your site on the local server as well as the online server, you will find great use for my plugin.</p>
<p>My plugin is designed to make it possible to remotely create and download wordpress database backup in form of SQL dumps. You can then use these dumps to sync the local version of your site with the online version.</p>
<p><img src="http://www.bin-co.com/tools/wordpress/plugins/db_backup/db_backup.png" alt="Remote Database Backup Screenshot" /></p>
<h2>Backuping your WordPress Database</h2>
<ul>
<li>Install Remote Database Backup Plugin in WordPress</li>
<li>Login to WordPress site</li>
<li>Go to the Backup Page(Manage &gt; DB Backup)</li>
<li>Create a backup</li>
<li>Download the backup file to your system</li>
</ul>
<h3>Sync With Local Server</h3>
<p>And if you have a local version of your site, you can sync it with the online site using the backup file. Just follow these steps&#8230;</p>
<ul>
<li>Extract the backup file(its in the tar.gz format)</li>
<li><a href="http://txt.binnyva.com/2007/03/mysql-database-backuprestore/">Import it into your mysql database</a>.</li>
<li>Make some changes to the database(like set the home url) so that wordpress works locally</li>
</ul>
<h2>Automation Script</h2>
<p>You can do all these steps manually &#8211; or you can use the <a href="http://www.bin-co.com/blog/wp-content/uploads/2008/10/backup.txt">automation script</a> I have cooked up. You need PHP installed in your system for this to work(I assume you already have PHP if you have a local version of wordpress).</p>
<p>To use the script, first install the plugin. Then download <a href="http://www.bin-co.com/blog/wp-content/uploads/2008/10/backup.txt">the script</a> and rename it to &#8216;backup.php&#8217;(the extension must be &#8216;php&#8217; instead of &#8216;txt&#8217;. Now open it in your favorite editor and change the variables to match your site. You can run it by opening a terminal/command prompt and navigating to that folder and executing the command &#8216;php backup.php&#8217;. This will automatically make a backup and sync it with your local database.</p>
<h2>Need Feedback</h2>
<p>Let me know how it works for you if you are installing the plugin &#8211; its the first release &#8211; so I need some feedback.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bin-co.com/blog/2008/10/remote-database-backup-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>Compile and Install a LAMP(Linux/Apache/MySQL/PHP) Server from Source</title>
		<link>http://www.bin-co.com/blog/2008/09/compile-install-lamp-linux-apache-mysql-php-server-from-source/</link>
		<comments>http://www.bin-co.com/blog/2008/09/compile-install-lamp-linux-apache-mysql-php-server-from-source/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 18:00:07 +0000</pubDate>
		<dc:creator>Binny V A</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://www.bin-co.com/blog/?p=132</guid>
		<description><![CDATA[In the last post, I described the method to install a LAMP server using apt in debian. But in some occasions, we need the latest build of the software - then we have to install it from source.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2008/09/lava_lamp.jpg" alt="LAMP - Linux, Apache, MySQL, PHP" title="LAMP - Linux, Apache, MySQL, PHP" width="232" height="294" class="size-full wp-image-128 intro" align="right" /></p>
<p class="intro">In the last post, I described the method to <a href="http://www.bin-co.com/blog/2008/09/installing-lampapache-web-serverphpmysql-in-debian/">install a LAMP server using apt in debian</a>. But in some occasions, we need the latest build of the software &#8211; then we have to install it from source.</p>
<p>Before installation, a few points to remember. These instruction are not for a production environment &#8211; this is for a development environment. Some of the commands(the <code>make install</code> commands) need root access. You can get that using this command <code>su -</code> and entering the root password at the prompt.</p>
<h2>Installing MySQL 5</h2>
<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2008/09/mysql_logo.gif" alt="" title="MySQL Logo" width="150" height="98" class="alignnone size-full wp-image-127" align="right" /></p>
<p><strong class="highlight">Download MySQL source tarballs</strong> from <a href="http://dev.mysql.com/downloads/" class="external">MySQL.com</a>. Make sure that you have downloaded the latest releases. At the time of writing this, MySQL 5.0 was the latest. <strong class="highlight">Open a terminal</strong> and login as the root user. <strong class="highlight">Extract</strong> the source to some folder(say &#8216;/usr/src/mysql&#8217;).</p>
<pre><code class="cli"></code>$ mkdir /usr/src/mysql
$ cp mysql-VERSION.tar.gz /usr/src/mysql
$ cd /usr/src/mysql
$ gunzip &lt; mysql-VERSION.tar.gz | tar -xvf -
$ cd mysql-VERSION</code></pre>
<p>For added security we will create a <strong class="highlight">new user called &#8216;mysql&#8217;</strong> and use this user while running MySQL.</p>
<pre><code class="cli">$ groupadd mysql
$ useradd -g mysql mysql</code></pre>
<p>Now we will <strong class="highlight">compile and install MySQL</strong> &#8211; this will take some time.</p>
<pre><code class="cli">$ ./configure --prefix=/usr/local/mysql [add the necessary extra options here]
$ make
$ make install</code></pre>
<p>After installing, we have to <strong class="highlight">configure MySQL</strong>.</p>
<pre><code class="cli">$ cp support-files/my-medium.cnf /etc/my.cnf
$ cd /usr/local/mysql
$ bin/mysql_install_db --user=mysql
$ chown -R root  .
$ chown -R mysql lib
$ chgrp -R mysql .</code></pre>
<p>Start MySQL</p>
<pre><code class="cli">$ bin/mysqld_safe --user=mysql &amp;</code></pre>
<p>If all goes well, you will be able to <strong class="highlight">connect to the mysql server</strong> using some clients like <a href="http://www.phpmyadmin.net/home_page/" class="external">phpMyAdmin</a> or <a href="http://www.mysqlfront.de/" class="external">MySQL Frontend</a>. For testing we will use the command line client provided with MySQL. In terminal type&#8230;</p>
<pre><code class="cli">$ mysql</code></pre>
<p>Now you should see <strong class="highlight">mysql command shell</strong> &#8211; something like this&#8230;</p>
<pre><code class="cli">Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.21-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql&lt;</code></pre>
<p>Here you can <strong class="highlight">run SQL command</strong> and see the returned results. Try some out&#8230;</p>
<pre><code class="mysql">SHOW DATABASES;</code></pre>
<p>That&#8217;s it &#8211; we have installed MySQL. You can <strong class="highlight">start the server</strong> using the command</p>
<pre><code class="cli">cd /usr/local/mysql ; bin/mysqld_safe --user=mysql &amp;</code></pre>
<p>If <strong class="highlight">anything went wrong</strong>, cry for sometime and then <strong class="highlight">consult the documentation</strong>.</p>
<h2>Installing Apache 2</h2>
<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2008/09/apache.png" alt="" title="Apache Logo" width="230" height="90" class="alignnone size-full wp-image-126" style="right" /></p>
<p>Same as in MySQL, download the source from <a href="http://httpd.apache.org/download.cgi" class="external">Apache.org</a>. Extract to /usr/src/httpd.</p>
<pre><code class="cli">$ mkdir /usr/src/httpd
$ cp httpd-VERSION.tar.gz /usr/src/httpd
$ cd /usr/src/httpd
$ gunzip &lt; httpd-VERSION.tar.gz | tar -xvf -
$ cd httpd-VERSION</code></pre>
<p>Compile and Install&#8230;</p>
<pre><code class="cli">$ ./configure --prefix=/usr/local/apache2 [add extra options here]
$ make
$ make install</code></pre>
<p>The configure command I used is given below &#8211; you can change it if you feel like it.</p>
<pre><code class="cli">./configure --prefix=/usr/local/apache2 --enable-mime-magic --enable-expires \
--enable-headers --enable-ssl --enable-http --enable-info --enable-dir \
--enable-rewrite --enable-so</code></pre>
<p>We will hold off configuration of Apache until after the PHP installation.</p>
<h2>Installing PHP 5</h2>
<p><img src="http://www.bin-co.com/blog/wp-content/uploads/2008/09/php-logo.png" alt="" title="PHP Logo Custom" width="179" height="98" class="alignnone size-full wp-image-123" align="right" /></p>
<p>You know the drill &#8211; <strong class="highlight"><a href="http://www.php.net/downloads.php">download PHP 5</a>, extract to /usr/src/php5</strong>.</p>
<pre><code class="cli">$ mkdir /usr/src/php5
$ cp php-VERSION.tar.gz /usr/src/php5
$ cd /usr/src/php5
$ gunzip &lt; php-VERSION.tar.gz | tar -xvf -
$ cd php-VERSION</code></pre>
<p>Building PHP is a little more complicated than the other two. PHP have a lot of options, and must be customized according to your needs. You can see all the available configurations by running the command <code>./configure --help</code>. If you require more information about this, take a look at <a href="http://www.php.net/manual/en/configure.php" class="external">PHP documentation on <code>configure</code></a>.</p>
<p>My requirements may not match yours &#8211; some you have to make your own decisions here. I am providing the most basic configuration for the build&#8230;</p>
<pre><code class="cli">./configure \
--prefix=/usr/local/php5 \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=shared,/usr/local/mysql [add your options here]</code></pre>
<p>You can add all your configuration to this line. The &#8211;with-apxs2 lines tells the installer where to find Apache2 executables and the &#8211;with-mysql configuration is the location of the mysql libraries. These two lines are a must.</p>
<p>This is the actual command I used&#8230;</p>
<pre><code class="cli">./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=shared,/usr/local/mysql --with-zlib --with-gettext --with-gdbm --with-sqlite</code></pre>
<p>Now to install the language&#8230;</p>
<pre><code class="cli">$ ./configure \
$ --prefix=/usr/local/php5 \
$ --with-apxs2=/usr/local/apache2/bin/apxs \
$ --with-mysql=shared,/usr/local/mysql [add your options here]
$ make
$ make install</code></pre>
<p>Now copy the php.ini file to the necessary location&#8230;</p>
<pre><code class="cli">cp php.ini-dist /usr/local/php5/lib</code></pre>
<p>Wonderful! Now we have everything we need &#8211; we just have to configure it.</p>
<h2>Configuring Apache</h2>
<p>The <strong class="highlight">Apache can be configured by editing a single text file</strong>. This file is usually located in <code>Apache_folder/conf/httpd.conf</code>. In our case this will be <code>/usr/local/apache2/conf/httpd.conf</code> . Open this file in you favorite text editor and change the following lines. Please note that some lines may be different in you apache configuration file &#8211; so if you can&#8217;t find the line when you search with the full line, try to find the line using just the identifier. For example, if you can&#8217;t find the text &#8216;<code>DocumentRoot "/usr/local/apache2/htdocs"</code>&#8216; in your httpd.conf file, search for the text &#8216;<code>DocumentRoot</code>&#8216;.</p>
<h3>Configuration Options</h3>
<p>You may want to change the document root &#8211; replace the line</p>
<pre><code>DocumentRoot "/usr/local/apache2/htdocs"</code></pre>
<p>With</p>
<pre><code>DocumentRoot "/var/www/htdocs" # Or whatever folder you want to set as the document root.</code></pre>
<p>Also change the line</p>
<pre><code>&lt;Directory "/usr/local/apache2/htdocs"&gt;</code></pre>
<p>to</p>
<pre><code>&lt;Directory "/var/www/htdocs"&gt;</code></pre>
<p>I don&#8217;t have to tell you that you can use any directory you want &#8211; you don&#8217;t have to use &#8216;/var/www/htdocs&#8217; just because I use it. If you are using another directory, make sure that you change both the above given lines to that directory.</p>
<p>If you want to use .htaccess file to configure different folders, find the line</p>
<pre><code>AllowOverride None</code></pre>
<p>inside the <code>&lt;Directory "/usr/local/apache2/htdocs"&gt; ... &lt;/Directory&gt;</code> tag and change it to </p>
<pre><code>AllowOverride All</code></pre>
<p>Since we are using PHP, and want to use index.php as the default page in a directory, we have to set that configuration option. Find the line </p>
<pre><code>DirectoryIndex index.html index.html.var</code></pre>
<p>and replace it with, say,</p>
<pre><code>DirectoryIndex index.php index.html index.html.var</code></pre>
<p>This will make sure that the index.php will be called when you try to access a directory. For example, if you try to access, say, http://localhost/ you will get a file listing. But if you put a file named &#8216;index.php&#8217; in this folder, the server will open this file when someone accesses &#8216;http://localhost/&#8217;. The order of the names are important. If there is a file called &#8216;index.php&#8217; and a file called &#8216;index.html&#8217; in the same folder, the first one(in our case index.php) will be opened.</p>
<p>Now we must associate all files with the extension &#8216;php&#8217; with the PHP scripts handler. For this find the line</p>
<pre><code>AddHandler type-map var</code></pre>
<p>and add the following line below that line &#8211; like this</p>
<pre><code>AddHandler type-map var
AddHandler php5-script	php</code></pre>
<p>Below that there is a AddType section. Add the following line to this section.</p>
<pre><code>AddType application/x-httpd-php .php</code></pre>
<h2>Start the Server</h2>
<p>You can test your installation by starting your server. Open a terminal and run the following command.</p>
<pre><code class="cli">/usr/local/apache2/bin/apachectl start</code></pre>
<p>Go to your document root(<code>/var/www/htdocs</code>) and create a php file called &#8216;info.php&#8217; and put this code inside it&#8230;</p>
<pre><code class="php">&lt;?php
php<!-- wp bugfix -->info();

</code></pre>
<p>Now open a browser and try to access <a href="http://localhost/">http://localhost/</a> &#8211; you should see a file listing page with a &#8216;info.php&#8217; in the list. Click on that link &#8211; if you see a PHP information page, your web server is setup correctly.</p>
<p>To make sure MySQL-PHP connection is working, <a href="http://www.bin-co.com/database/clients/phpmyadmin/installing_phpmyadmin.php">install phpMyAdmin</a> &#8211; or write a database connection script &#8211; whatever is easier for you.</p>
<p><strong class="highlight">Shameless Plug</strong>: If you are a Linux user, you may want to check out my <a href="http://lindesk.com/">Linux Blog &#8211; LinDesk</a> &#8211; its about Linux on the Desktop &#8211; Articles, Application Reviews and Tutorials about many aspects of Linux included configuration and scripting.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bin-co.com/blog/2008/09/compile-install-lamp-linux-apache-mysql-php-server-from-source/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
