<?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>Venky&#039;s Blog</title>
	<atom:link href="http://www.venkysblog.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.venkysblog.com</link>
	<description>Web 2.0 Style Blog on Custom Technology</description>
	<lastBuildDate>Mon, 18 Jan 2010 02:59:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Install Python2.6.4, mod_wsgi and Django on CentOS 5.4</title>
		<link>http://www.venkysblog.com/2009/12/centos-python-wsgi-dango/</link>
		<comments>http://www.venkysblog.com/2009/12/centos-python-wsgi-dango/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 15:07:02 +0000</pubDate>
		<dc:creator>Venky</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Communication]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[FreeSWITCH]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[WikiPBX]]></category>

		<guid isPermaLink="false">http://www.venkysblog.com/?p=124</guid>
		<description><![CDATA[The day I got Django running on windows, I started hacking around setting Django up on CentOS. Little did I know upgrading Python and getting Django wouldn&#8217;t be that easy. CentOS 5.4 uses python 2.4, and replacing it is not really an option since yum and other core packages depend on it. The solution was [...]]]></description>
			<content:encoded><![CDATA[<p>The day I got <strong>Django</strong> running on windows, I started hacking around setting Django up on CentOS. Little did I know upgrading <strong>Python </strong>and getting <strong>Django</strong> wouldn&#8217;t be that easy. <strong>CentOS 5.4</strong> uses python 2.4, and replacing it is not really an option since yum and other core packages depend on it. The solution was to install 2.6.4 from source and use /opt for the prefix  so that 2.6.4 becomes the default python. Then move on to install mod_wsgi, setup Apache to use mod_wsgi and Install Django on CentOS 5.4<br />
<span id="more-124"></span></p>
<h3>Install Build Requirements</h3>
<p>Run the following command as root (or with sudo) to install gcc and the development libraries used by python:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">gcc</span> gdbm-devel readline-devel ncurses-devel zlib-devel bzip2-devel sqlite-devel db4-devel openssl-devel tk-devel bluez-libs-devel</pre></div></div>

<p><strong>Install Python</strong></p>
<p>Download Python 2.6 source package, unzip, and enter working directory:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.python.org<span style="color: #000000; font-weight: bold;">/</span>ftp<span style="color: #000000; font-weight: bold;">/</span>python<span style="color: #000000; font-weight: bold;">/</span>2.6.4<span style="color: #000000; font-weight: bold;">/</span>Python-2.6.4.tgz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvfz Python-2.6.4.tgz
<span style="color: #7a0874; font-weight: bold;">cd</span> Python-2.6.4</pre></td></tr></table></div>

<p>Configure Python 2.6 so that we&#8217;re not overwriting the system&#8217;s python installation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>python2.6 <span style="color: #660033;">--with-threads</span> <span style="color: #660033;">--enable-shared</span></pre></div></div>

<p>Make and install:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span>
   <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></td></tr></table></div>

<p>After running the make command you will see a list of modules that were not built. If you installed all of the devel libraries listed above, the only missing modules should be bsddb185 and sunaudiodev. You probably don’t need these – bsddb185 is the old version of the berkely db module, and sunaduiodev is for solaris. On x86_64 db and imageop may also be in the list, but looking at the setup.py, it looks like this is normal.</p>
<p>Add an alias to root&#8217;s .bash_profile:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #c20cb9; font-weight: bold;">vi</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_profile
<span style="color: #7a0874; font-weight: bold;">alias</span> <span style="color: #007800;">python</span>=<span style="color: #ff0000;">'/opt/python2.6/bin/python'</span>
<span style="color: #7a0874; font-weight: bold;">source</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_profile</pre></td></tr></table></div>

<p>Make a symbolic link:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>python2.6<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>python <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>python2.6</pre></div></div>

<p>Configure ld to find your shared libs:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ld.so.conf.d<span style="color: #000000; font-weight: bold;">/</span>opt-python2.6.conf</pre></div></div>

<p>Now Enter the following:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>python2.6<span style="color: #000000; font-weight: bold;">/</span>lib <span style="color: #7a0874; font-weight: bold;">&#40;</span>hit enter<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #7a0874; font-weight: bold;">&#40;</span>hit ctrl-d to <span style="color: #7a0874; font-weight: bold;">return</span> to shell<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    ldconfig</pre></td></tr></table></div>

<p>Test python 2.6 installation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">python</pre></div></div>

<p>You should get an interactive Python 2.6 session like:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  Python <span style="color: #000000;">2.6</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>r25:XXXX, Dec <span style="color: #000000;">11</span> <span style="color: #000000;">2009</span>, <span style="color: #000000;">23</span>:<span style="color: #000000;">18</span>:<span style="color: #000000;">24</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #7a0874; font-weight: bold;">&#91;</span>GCC X.XXXXX.X 
    Type <span style="color: #ff0000;">&quot;help&quot;</span>, <span style="color: #ff0000;">&quot;copyright&quot;</span>, <span style="color: #ff0000;">&quot;credits&quot;</span> or <span style="color: #ff0000;">&quot;license&quot;</span> <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">more</span> information.
&nbsp;
    <span style="color: #000000; font-weight: bold;">&gt;&gt;&gt;</span>
&nbsp;
    Hit ctrl-d to <span style="color: #7a0874; font-weight: bold;">exit</span></pre></div></div>

<p><strong>Install setuptools</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">cd..
    <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>pypi.python.org<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2.6</span><span style="color: #000000; font-weight: bold;">/</span>s<span style="color: #000000; font-weight: bold;">/</span>setuptools<span style="color: #000000; font-weight: bold;">/</span>setuptools-0.6c11-py2.6.egg<span style="color: #666666; font-style: italic;">#md5=bfa92100bd772d5a213eedd356d64086</span>
    <span style="color: #c20cb9; font-weight: bold;">sh</span> setuptools-0.6c11-py2.6.egg <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>python2.6</pre></td></tr></table></div>

<p><strong>Install MySQL</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>download.fedora.redhat.com<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>epel<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>i386<span style="color: #000000; font-weight: bold;">/</span>epel-release-<span style="color: #000000;">5</span>-3.noarch.rpm
  <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>rpms.famillecollet.com<span style="color: #000000; font-weight: bold;">/</span>enterprise<span style="color: #000000; font-weight: bold;">/</span>remi-release-5.rpm
  rpm <span style="color: #660033;">-Uvh</span> remi-release-<span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">*</span>.rpm epel-release-<span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">*</span>.rpm
yum <span style="color: #660033;">--enablerepo</span>=remi <span style="color: #c20cb9; font-weight: bold;">install</span> mysql-server mysql-devel python-devel</pre></td></tr></table></div>

<p><strong>Install MySQLdb package</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>internap.dl.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>sourceforge<span style="color: #000000; font-weight: bold;">/</span>mysql-python<span style="color: #000000; font-weight: bold;">/</span>MySQL-python-1.2.2.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvfz MySQL-python-1.2.2.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> MySQL-python-1.2.2
python setup.py build
python setup.py <span style="color: #c20cb9; font-weight: bold;">install</span></pre></td></tr></table></div>

<p>Verify MySQL-Phyton DB adapter:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">python</pre></div></div>

<p>In the prompt below:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">    Python <span style="color: #000000;">2.5</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>r25:<span style="color: #000000;">51908</span>, Nov <span style="color: #000000;">9</span> <span style="color: #000000;">2008</span>, <span style="color: #000000;">23</span>:<span style="color: #000000;">18</span>:<span style="color: #000000;">24</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #7a0874; font-weight: bold;">&#91;</span>GCC 4.1.2 <span style="color: #000000;">20071124</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Red Hat 4.1.2-<span style="color: #000000;">42</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> on linux2
    Type <span style="color: #ff0000;">&quot;help&quot;</span>, <span style="color: #ff0000;">&quot;copyright&quot;</span>, <span style="color: #ff0000;">&quot;credits&quot;</span> or <span style="color: #ff0000;">&quot;license&quot;</span> <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">more</span> information.
    <span style="color: #000000; font-weight: bold;">&gt;&gt;&gt;</span> import MySQLdb
    <span style="color: #000000; font-weight: bold;">&gt;&gt;&gt;</span></pre></div></div>

<p>There should be no errors on the screen. So far so good!</p>
<p><strong>Install Apache2 and Apache2 Devel</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> httpd
yum <span style="color: #c20cb9; font-weight: bold;">install</span> httpd-devel</pre></td></tr></table></div>

<p><strong>Installing mod_wsgi</strong></p>
<p>What is mod_wsgi?</p>
<p>The aim of mod_wsgi is to implement a simple to use Apache module which can host any Python application which supports the Python WSGI interface. The module would be suitable for use in hosting high performance production web sites, as well as your average self managed personal sites running on web hosting services.<br />
Why mod_wsgi?</p>
<p>The consensus seems to be that mod_wsgi is the prefered Apache module (as opposed to mod_python). It&#8217;s stable, less memory intensive, and faster.</p>
<p>Configure mod_wsgi to link with Python 2.6 shared libs:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>python2.6<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>python2.6<span style="color: #000000; font-weight: bold;">/</span>config
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> ..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>libpython2.6.so .
<span style="color: #7a0874; font-weight: bold;">cd</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>modwsgi.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>mod_wsgi-3.1.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvfz mod_wsgi-3.1.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> mod_wsgi-<span style="color: #000000;">3.1</span>
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-python</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>python2.6<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>python</pre></td></tr></table></div>

<p>Make and install:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></td></tr></table></div>

<p>It’s important to read the mod_wsgi docs on building with shared libs &#8211; mod_wsgi should compile to around 250kbytes.<br />
Confirm that the size of mod_wsgi.so is around 250 Kilobytes:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-Al</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span>mod_wsgi.so</pre></div></div>

<p>Mine turned out to be around 295 kilo bytes.</p>
<p><strong>Add mod_wsgi to Apache 2.x:</strong></p>
<p>vi /etc/httpd/conf/httpd.conf<br />
 LoadModule wsgi_module /usr/lib/httpd/modules/mod_wsgi.so</p>
<p>Restart Apache</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">service httpd restart</pre></div></div>

<p>Check if mod_wsgi is loaded in the loaded module list by typing</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">httpd <span style="color: #660033;">-M</span></pre></div></div>

<p><strong>Next <a href="http://www.djangoproject.com">Download Django</a></strong></p>
<p>Assuming your django download is extracted in /usr/src/django</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>django<span style="color: #000000; font-weight: bold;">/</span>django <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>python2.6<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>python2.6<span style="color: #000000; font-weight: bold;">/</span>site-packages<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>You should now be up and running django on CentOS. </p>
<p><strong>Important Notes:</strong><br />
1. SElinux does not go very well with wsgi environment. For testing, please turn off SElinux and then try these steps.<br />
2. Apache might use wrong python version while calling wsgi handlers. Use wsgihome and wgipythonpath directives inside the httpd.conf to point it correctly.<br />
3. In case of any errors, check the Apache error log for more details.</p>
<p>You can always post a comment here, in case of any help.</p>
<strong>Share this Post</strong><div id="sharepost" style="padding-top:10px;" >&nbsp;&nbsp;<a href="http://www.facebook.com/share.php?u=http://www.venkysblog.com/2009/12/centos-python-wsgi-dango/" target="_blank"><img src="http://www.venkysblog.com/images/shrfb.png" alt="Facebook" /></a>&nbsp;&nbsp;<a href="http://digg.com/submit?url=http://www.venkysblog.com/2009/12/centos-python-wsgi-dango/&amp;title=Install Python2.6.4, mod_wsgi and Django on CentOS 5.4&amp;bodytext=&amp;media=&amp;topic=" target="_blank"><img src="http://www.venkysblog.com/images/shrdg.png" alt="Digg It" /></a>&nbsp;&nbsp;<a href="http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=http://www.venkysblog.com/2009/12/centos-python-wsgi-dango/&amp;title=Install Python2.6.4, mod_wsgi and Django on CentOS 5.4" target="_blank"><img src="http://www.venkysblog.com/images/shrdl.png" alt="Delicious" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.venkysblog.com/2009/12/centos-python-wsgi-dango/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Run FusionPBX for FreeSWITCH on CentOS in 4 steps</title>
		<link>http://www.venkysblog.com/2009/12/fusionpbx-on-centos/</link>
		<comments>http://www.venkysblog.com/2009/12/fusionpbx-on-centos/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 14:17:11 +0000</pubDate>
		<dc:creator>Venky</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Communication]]></category>
		<category><![CDATA[FreeSWITCH]]></category>
		<category><![CDATA[Fusionpbx]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://www.venkysblog.com/?p=128</guid>
		<description><![CDATA[FusionPBX is customizable and flexible web interface to the very powerful and highly scalable multi-platform voice switch called FreeSWITCH. Yes of course its open source.It can be setup and run on any operating system you are comfortable with, bringing in the same flexibility as freeSWITCH. The thing I like about fusion is that its done [...]]]></description>
			<content:encoded><![CDATA[<p>FusionPBX is customizable and flexible web interface to the very powerful and highly scalable multi-platform voice switch called FreeSWITCH. Yes of course its open source.It can be setup and run on any operating system you are comfortable with, bringing in the same flexibility as freeSWITCH. The thing I like about fusion is that its done in PHP without any MVC framework dependencies. However that said, it is very powerful and a neat tool to mange your FreeSWITCH box. I was able to set it up and get running in under 10 mins.<br />
<span id="more-128"></span></p>
<h3>Below are some of the features of FusionPBX:</h3>
<p><strong>Unlimited extensions, voicemail-to-email, music on hold, call parking, Direct Inward System Access, Auto Attendant, Call Detail Records, Call Monitoring, Call Routing etc..</strong></p>
<p>For a complete list visit their <a href="http://www.fusionpbx.com/index.php?c=/features.php"><strong>website</strong></a></p>
<p><strong>Note:</strong> If you already have Apache, PHP and MySQL &#038; Phpmyadmin setup, then jump directly to step 4</p>
<p><strong>Step 1:</strong> Install Install Apache2</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> httpd httpd-devel</pre></div></div>

<p><strong>Step 2:</strong> Install PHP 5.3(with PDO) &#038; MySQL</p>
<p>Since CentOS does not yet ship a recent enough version of PHP, so we you use the RPMs provided in the REMI repository. To do so:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>download.fedora.redhat.com<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>epel<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>i386<span style="color: #000000; font-weight: bold;">/</span>epel-release-<span style="color: #000000;">5</span>-3.noarch.rpm
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>rpms.famillecollet.com<span style="color: #000000; font-weight: bold;">/</span>enterprise<span style="color: #000000; font-weight: bold;">/</span>remi-release-5.rpm
rpm <span style="color: #660033;">-Uvh</span> remi-release-<span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">*</span>.rpm epel-release-<span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">*</span>.rpm</pre></td></tr></table></div>

<p>Now use remi to install php and MySQL</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #660033;">--enablerepo</span>=remi <span style="color: #c20cb9; font-weight: bold;">install</span> php php-common php-mysql php-gd php-mbstring php-mcrypt php-devel php-pdo php-soap php-xml php-xmlrpc mysql mysql-server mysql-devel</pre></div></div>

<p><strong>Step 3:</strong> Install Phpmyadmin (This step is optional)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #660033;">--enablerepo</span>=remi <span style="color: #c20cb9; font-weight: bold;">install</span> phpmyadmin</pre></div></div>

<p>You might encounter the following errors while configuring phpmyadmin.</p>
<p><strong>1. Forbidden : You don&#8217;t have permission to access /phpmyadmin/ on this server.</strong></p>
<p>Fix:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">vi /etc/httpd/conf.d/phpmyadmin.conf 
&nbsp;
Remove or comment the first two lines in bold.
&nbsp;
&lt;strong&gt;#Order Allow,Deny
#Deny from all&lt;/strong&gt;
Allow from 127.0.0.1</pre></div></div>

<p><strong>2. Error: The configuration file now needs a secret passphrase (blowfish_secret)</strong></p>
<p>Fix</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">vi /usr/share/phpmyadmin/conf.inc.php
&nbsp;
Look for a line and enter any password. Just dont leave it empty!
&nbsp;
$cfg['blowfish_secret'] = 'mydemopass'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
&nbsp;
Now, Restart the Apache Server
&nbsp;
service httpd restart</pre></div></div>

<p><strong>To Test</strong></p>
<p>   1. Open http://localhost/phpmyadmin in your local web browser. You should be prompted for authentication<br />
   2. Enter the system root username and password and click OK<br />
   3. You should now be presented with the phpMyAdmin home page</p>
<p><strong><br />
Step 4 :</strong> Download and install FusionPBX</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.fusionpbx.com<span style="color: #000000; font-weight: bold;">/</span>downloads<span style="color: #000000; font-weight: bold;">/</span>fusionpbx-1.0.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-zxvf</span> fusionpbx-1.0.tar.gz</pre></td></tr></table></div>

<p>Now Restart apache</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">service httpd restart</pre></div></div>

<p>Next create a database name fusionpbx using Phpmyadmin. If needed you can also create a separate db user or by default we can use root.</p>
<p>Now Open the fusionpbx Auto-Install Wizard</p>
<p>http://(yourserver hostname or localhost)/fusionpbx/install.php </p>
<p>On the Install screen enter the mysql db name, user, password you created. For the database host you can use localhost and the port can be empty.</p>
<p>On Submission, if you see any of the below errors, then please fix these before trying again:</p>
<p>    * Write access to /var/www/html/fusionpbx/includes/ is required during the install.<br />
    * Write access to the &#8216;FreeSWITCH Directory&#8217; and most of its sub directories is required.<br />
    * Write access to the &#8216;Secure Directory&#8217; is required. If the /var/www/html/fusionpbx/secure is incorrect please change it below.<br />
    *  Write access to /var/www/html/fusionpbx  and its sub-directories are required during the install.</p>
<p>This is basically a permission issue, so change the permissions for write access</p>
<p>Correct all the errors before you proceed further. Then click &#8220;Install&#8221; button to proceed further. </p>
<p>If all goes well, you should see a &#8220;Congratulations Page&#8221;. Cool&#8230; We are done.. Now play around with freeswitch and this powerful GUI. </p>
<p>Special thanks to Mark J Crane, the lead developer of Fusion, for supporting me through the install. It was a breeze.</p>
<strong>Share this Post</strong><div id="sharepost" style="padding-top:10px;" >&nbsp;&nbsp;<a href="http://www.facebook.com/share.php?u=http://www.venkysblog.com/2009/12/fusionpbx-on-centos/" target="_blank"><img src="http://www.venkysblog.com/images/shrfb.png" alt="Facebook" /></a>&nbsp;&nbsp;<a href="http://digg.com/submit?url=http://www.venkysblog.com/2009/12/fusionpbx-on-centos/&amp;title=Run FusionPBX for FreeSWITCH on CentOS in 4 steps&amp;bodytext=&amp;media=&amp;topic=" target="_blank"><img src="http://www.venkysblog.com/images/shrdg.png" alt="Digg It" /></a>&nbsp;&nbsp;<a href="http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=http://www.venkysblog.com/2009/12/fusionpbx-on-centos/&amp;title=Run FusionPBX for FreeSWITCH on CentOS in 4 steps" target="_blank"><img src="http://www.venkysblog.com/images/shrdl.png" alt="Delicious" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.venkysblog.com/2009/12/fusionpbx-on-centos/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Setup Django on Windows with Apache and MySQL in 15 mins</title>
		<link>http://www.venkysblog.com/2009/12/windows-apache-mysql-django/</link>
		<comments>http://www.venkysblog.com/2009/12/windows-apache-mysql-django/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 14:15:40 +0000</pubDate>
		<dc:creator>Venky</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://www.venkysblog.com/?p=94</guid>
		<description><![CDATA[Django is an open source web application development framework, for python. I am totally impressed with it as it allows rapid application development and provides a brilliant auto generated administrative interface for the web app. Setting up Django on Windows without Apache &#38; Mysql is fairly out of the box, but doing that in production [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Django</strong> is an open source web application development framework, for python. I am totally impressed with it as it allows rapid application development and provides a brilliant auto generated administrative interface for the web app. Setting up <strong>Django on Windows without Apache &amp; Mysql </strong>is fairly out of the box, but doing that in production is not recommended. Hence I tried to use existing portable and ready made stacks for Django on windows. Having tried them I would say, I wasted around 6 hours trying to get everything working. Bottom line: I decided to install Django on windows on my own using  <strong>WAMP + mod_wsgi + mysql_python to run Django on windows.</strong><br />
<span id="more-94"></span></p>
<h3>Lets see how:</h3>
<p><strong>Step 1:</strong> Install Python</p>
<p>The first step is to get the latest version of Python installed. Head over to <a href="http://www.python.org">Python.org</a> and download the stable installer version (2.6.X) for Windows. Double click and run it. The install is fairly simple, and involves clicking through the installer steps.</p>
<p>For the rest of this post, the assumption is that installed Python in <strong>&#8220;C:\Python26\&#8221;</strong></p>
<p><strong>Step 2:</strong> Download and setup Django</p>
<p>Download and extract the Django files. Copy the complete directory named &#8220;django&#8221;, inside the extracted directory and paste it under <strong>&#8220;C:\Python26\Lib\site-packages\&#8221;</strong></p>
<p><strong>Quick check:</strong> File &#8220;django-admin.py&#8221; should exist under the path &#8220;C:\Python26\Lib\site-packages\django\bin&#8221;</p>
<p>Now to be able to run python and Django from windows command line lets add it into the path variable.</p>
<p>Right click on <strong>“My Computer”</strong> and select <strong>Properties</strong>. Go to <strong>Advanced</strong>, then <strong>Environment Variables</strong> at the bottom. Edit <strong>“Path”</strong> and at the end add the following:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"> &quot;;C:\Python26;C\Python26\scripts;C:\Python26\Lib\site-packages\django\bin\”</pre></div></div>

<p>On the Windows command line type</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">python</pre></div></div>

<p>If you see an interactive python shell, Python is installed and running properly. To check Django installation, type</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> django</pre></div></div>

<p>You should see no errors. Congratulations Django is successfully installed on your system.</p>
<p>At this point, it would probably be a good idea to make sure that your Django install works before you attempt to get it working with Apache and mod_wsgi. So move forward to create a basic Django project and test the setup:</p>
<p>From the command prompt, enter into directory name where you wish to create your project:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">C:\  cd djangoTest</pre></div></div>

<p>Type the following to create the dummy project:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">C:\djangoTest  django-admin.py startproject testproject</pre></div></div>

<p>Now lets go inside the created project and run the project:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">C:\djangoTest  cd testproject
C:\djangoTest\testproject  python manage.py runserver</pre></div></div>

<p>You should get something like this on your screen:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Validating models...
0 errors found.
&nbsp;
Django version 1.1.1, using settings 'testproject.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[10/Dec/2009 20:45:50] “GET / HTTP/1.1? 404 2063</pre></div></div>

<p>Now, open your browser and type: <strong>127.0.0.1:8000</strong> and press enter.</p>
<p>If all was good, you should have your Django test page up.</p>
<p><strong>Step 3.</strong> Install WAMP</p>
<p>Download the <a href="http://www.wampserver.com/en/">WAMP stack</a>.  Double click and run the installer. Once again, the actual installation is simple and consists of clicking through the default installer steps.</p>
<p>After it is installed, you will the WAMP icon in your system tray. Left click on it and select &#8220;Start all Services&#8221;. After 10 seconds, left click again and click put online. Apache and MySQL should be running now.</p>
<p>To ensure Apache is running on port: 80, open the browser and type <strong>localhost</strong>. You should see the WAMP page now. Congrats.</p>
<p><strong>Step 4:</strong> Install mysql_python 2.6 for Mysql</p>
<p>Download MySQL_Python2.6 module <a href="http://www.codegood.com/">here</a></p>
<p>Run and install the file you just downloaded. Its a simple install.</p>
<p>Now, let’s test if the MySQL works currently with Django. Edit the database setting in <strong>‘testproject/settings.py’</strong>.</p>
<p>Here’s what I fill in. ‘root’ is the default user.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">    DATABASE_ENGINE = ‘mysql’
    DATABASE_NAME = ”
    DATABASE_USER = ‘root’
    DATABASE_PASSWORD = ”
    DATABASE_HOST = ”
    DATABASE_PORT = ”</pre></div></div>

<p>Run the server if it isn’t started:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">C:\djangoTest\testproject  python manage.py runserver</pre></div></div>

<p>If you see no error messages(in the browser and the console), the database works correctly with python. To do a bit of testing, we can set our user name wrongly on purpose and watch Python throw out the errors then correct it.</p>
<p>So far so good. Phew now the final step&#8230;</p>
<p><strong>Step 5:</strong>Install and enable mod_wsgi with Apache to run Django</p>
<p><a href="http://code.google.com/p/modwsgi/wiki/InstallationOnWindows">Download </a>the correct mod_wsgi file based on your apache and python. If you have followed this tutorial step by step you have Apache 2.2 and Python 2.6.</p>
<p>Rename the downloaded file as &#8220;mod_wsgi.so&#8221;</p>
<p>Copy the renamed file mod_wsgi.so to <strong>&#8220;C:\wamp\bin\apache\Apache2.2\modules&#8221;</strong> folder.</p>
<p>Now, open the Apache configuration file, located at <strong>&#8220;C:\wamp\bin\apache\Apache2.2\conf\httpd.conf&#8221;</strong> with notepad.</p>
<p>Scroll down and look for a section that includes a bunch of lines that start with <strong>LoadModule</strong>. Add the following line towards the end of that section:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">LoadModule wsgi_module modules/mod_wsgi.so</pre></div></div>

<p>Before we move further, copy your Django testProject folder into <strong>&#8220;C:/wamp/www&#8221;</strong>. This is not mandatory, but I did this, and the remaining instructions below are based on that.</p>
<p>Once you’ve got mod_wsgi installed and activated, edit your <strong>httpd.conf</strong> file and add:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">WSGIScriptAlias / &quot;c:/wamp/www/testProject/django.wsgi&quot;</pre></div></div>

<p>Next we&#8217;ll need to actually create the <strong>django.wsgi WSGI application</strong>, so create a file <strong>&#8220;django.wsgi&#8221;</strong> and add:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>, <span style="color: #dc143c;">sys</span>
<span style="color: #dc143c;">sys</span>.<span style="color: black;">path</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'c:/wamp/www/'</span><span style="color: black;">&#41;</span>
<span style="color: #dc143c;">os</span>.<span style="color: black;">environ</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'DJANGO_SETTINGS_MODULE'</span><span style="color: black;">&#93;</span> = <span style="color: #483d8b;">'testProject.settings'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> django.<span style="color: black;">core</span>.<span style="color: black;">handlers</span>.<span style="color: black;">wsgi</span>
application = django.<span style="color: black;">core</span>.<span style="color: black;">handlers</span>.<span style="color: black;">wsgi</span>.<span style="color: black;">WSGIHandler</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Now restart Apache, and boom you should see your &#8220;It Worked&#8221; Page.</p>
<p>Congratulations!! Wasn&#8217;t this easy, and just in time &#8211; 15 mins &#8230;</p>
<p>If this helps you, leave a comment, tweet or share this post.</p>
<p>PS: Updated this post with typos and other errors based on input from <strong>justin.</strong> Many thanks to him for pointing it out.</p>
<strong>Share this Post</strong><div id="sharepost" style="padding-top:10px;" >&nbsp;&nbsp;<a href="http://www.facebook.com/share.php?u=http://www.venkysblog.com/2009/12/windows-apache-mysql-django/" target="_blank"><img src="http://www.venkysblog.com/images/shrfb.png" alt="Facebook" /></a>&nbsp;&nbsp;<a href="http://digg.com/submit?url=http://www.venkysblog.com/2009/12/windows-apache-mysql-django/&amp;title=Setup Django on Windows with Apache and MySQL in 15 mins&amp;bodytext=&amp;media=&amp;topic=" target="_blank"><img src="http://www.venkysblog.com/images/shrdg.png" alt="Digg It" /></a>&nbsp;&nbsp;<a href="http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=http://www.venkysblog.com/2009/12/windows-apache-mysql-django/&amp;title=Setup Django on Windows with Apache and MySQL in 15 mins" target="_blank"><img src="http://www.venkysblog.com/images/shrdl.png" alt="Delicious" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.venkysblog.com/2009/12/windows-apache-mysql-django/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Fed up with making rotis 3 times a day, here is Rotimatic !!</title>
		<link>http://www.venkysblog.com/2009/11/rotimatic_pranoti/</link>
		<comments>http://www.venkysblog.com/2009/11/rotimatic_pranoti/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 19:00:36 +0000</pubDate>
		<dc:creator>Venky</dc:creator>
				<category><![CDATA[BOTS]]></category>
		<category><![CDATA[Entrepreneurship]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.venkysblog.com/?p=81</guid>
		<description><![CDATA[Love the Indian Bread &#8211; Roti, but fed up with the hassles of making it. 800 million people in India eat over 2.3 billion rotis a day. Chapati or roti is a staple in Indian diet. Yet it can take over 30 minutes to prepare a simple meal of roti. Repeating this at least three [...]]]></description>
			<content:encoded><![CDATA[<p>Love the Indian Bread &#8211; Roti, but fed up with the hassles of making it. 800 million people in India eat over 2.3 billion rotis a day. Chapati or roti is a staple in Indian diet. Yet it can take over 30 minutes to prepare a simple meal of roti. Repeating this at least three times every day is a cumbersome process. What if you could, make rotis, with a push of a button. Yes, Now you have help at hand &#8211; <strong>Rotimatic</strong><br />
<span id="more-81"></span><br />
An invention of an 25 year old girl from India , Pranoti Nagarkar Israni, &#8220;Rotimatic&#8221;, is all set to be the rice cooker for the roti-eating population.</p>
<div id="attachment_84" class="wp-caption aligncenter" style="width: 310px"><img src="http://www.venkysblog.com/wp-content/uploads/2009/11/rotimatic-300x218.jpg" alt="Rotimatic" title="rotimatic" width="300" height="218" class="size-medium wp-image-84" /><p class="wp-caption-text">Rotimatic</p></div>
<p>As you see above, the appliance, is about the size of a mini-microwave oven, does the measuring, mixing, kneading, making, and baking of rotis, with users only required to refill the wheat and water compartments after a few days. Just the flick of the button and the chapati is ready. What you gotta do is add water and flour to the machine and leave this innovative roti maker to do its job. Compact, elegant and user-friendly, the roti maker sits on your kitchen top and prepares chapati for your family in just a flash of a second. The smart ingenious attributes of this cute little buddy won it the top position in the Singapore 2009 Business Plan Competition.</p>
<p>Rotimatic is a product of Zimplistic Pte Ltd., based out of singapore. Zimplistic recently won the prestigious StartUp@Singapore 2009 grand champion trophy, which comes with $28,000 in prize money and one free year of office space. Prior to this, Zimplistic was awarded the YES! Spring Singapore grant for young entrepreneurs valued at $35,000. Pranoti Israni, the founder of Zimplistic aims to partner or license with a consumer appliance brand to bring Rotimatic to market in 2010.</p>
<p>Pranoti Nagarkar Israni is no stranger to product design. Only in her 20s, she left her job at a leading electronic manufacturer to start-up on her own.  She graduated from NUS and majored in mechanical engineering from Singapore who launched her own startup in June 2008 when she came up with her first invention, the “Rotimatic”.</p>
<p>Hats off to you, for coming out with this one !!</p>
<strong>Share this Post</strong><div id="sharepost" style="padding-top:10px;" >&nbsp;&nbsp;<a href="http://www.facebook.com/share.php?u=http://www.venkysblog.com/2009/11/rotimatic_pranoti/" target="_blank"><img src="http://www.venkysblog.com/images/shrfb.png" alt="Facebook" /></a>&nbsp;&nbsp;<a href="http://digg.com/submit?url=http://www.venkysblog.com/2009/11/rotimatic_pranoti/&amp;title=Fed up with making rotis 3 times a day, here is Rotimatic !!&amp;bodytext=&amp;media=&amp;topic=" target="_blank"><img src="http://www.venkysblog.com/images/shrdg.png" alt="Digg It" /></a>&nbsp;&nbsp;<a href="http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=http://www.venkysblog.com/2009/11/rotimatic_pranoti/&amp;title=Fed up with making rotis 3 times a day, here is Rotimatic !!" target="_blank"><img src="http://www.venkysblog.com/images/shrdl.png" alt="Delicious" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.venkysblog.com/2009/11/rotimatic_pranoti/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tutorial: Add face detection to your PHP apps in 4 Steps..</title>
		<link>http://www.venkysblog.com/2009/11/face-detection-in-php/</link>
		<comments>http://www.venkysblog.com/2009/11/face-detection-in-php/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 06:52:21 +0000</pubDate>
		<dc:creator>Venky</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Image Processing]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://www.venkysblog.com/?p=48</guid>
		<description><![CDATA[It seems that the trend right now within image hosting sites (be it social networks like facebook &#38; orkut or specialized sites like picporta), is the ability to detect faces within user uploaded images.   While it once may have required a great deal of skill and understanding of image processing techniques, that is no longer [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that the trend right now within image hosting sites (be it social networks like facebook &amp; orkut or specialized sites like picporta), is the ability to detect faces within user uploaded images.   While it once may have required a great deal of skill and understanding of image processing techniques, that is no longer the case.  In this tutorial, I&#8217;ll show you how to easily detect faces  within your PHP apps in just 5 steps.<br />
<span id="more-48"></span></p>
<h3>Face Detection in a PHP app</h3>
<p><strong>Face Detection</strong><br />
Face detection is the ability to detect a presence of faces within an image. It is very different from face recognition where the focus is matching faces to a known database of faces. Face detection works best when the face is a frontal shot. However there are advanced algorithms which make detection in side shots also possible.</p>
<p><strong>The Solution</strong>: We will write a php script, which will  detect faces automatically, using OpenCV (a computer vision library) and PHP Facedetect(a php wrapper to opencv). Both are free to download and opensource.</p>
<p><strong>Requirements</strong><br />
- Basic PHP scripting skills<br />
- Linux server running Centos with SSH access<br />
- PHP/Apache<br />
- GD Library</p>
<p>Lets, Get Started..</p>
<p><strong>Step 1:</strong> Install OpenCV and its dependencies</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> yum <span style="color: #c20cb9; font-weight: bold;">install</span> opencv</pre></div></div>

<p>OpenCV needs the following dependencies to work properly:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> ibpng libpng-dev zlib libjpeg libjpeg-dev libtiff libjasper swig python pkgconfig gtk gtk-dev</pre></div></div>

<p>See <a href="http://opencv.willowgarage.com/wiki/InstallGuide_Linux" target="_blank"> here </a> for troubleshooting and advanced installation instructions.</p>
<p><strong>Step 2:</strong> Compile &amp; Test Run OpenCV</p>
<p>OpenCV is installed in /usr/local/share/opencv</p>
<p>In the /usr/local/share/opencv/samples/c/ folder, Run the following commands:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PKG_CONFIG_PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>pkgconfig
 .<span style="color: #000000; font-weight: bold;">/</span>build_all.sh</pre></td></tr></table></div>

<p>Test run OpenCV</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  .<span style="color: #000000; font-weight: bold;">/</span>facedetect <span style="color: #660033;">--cascade</span>=<span style="color: #ff0000;">&quot;../haarcascades/haarcascade_frontalface_alt.xml&quot;</span> test.jpg</pre></div></div>

<p>If all is fine, you should see the processing time. If you see errors, then see <a href="http://smsoftdev-solutions.blogspot.com/2009/06/opencv-shared-libraries-error.html" target="_blank">here</a></p>
<p><strong>Step 3:</strong> Download and Install PHPFacedetect</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.xarg.org<span style="color: #000000; font-weight: bold;">/</span>download<span style="color: #000000; font-weight: bold;">/</span>facedetect-1.0.0.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> zxf facedetect-1.0.0
yum <span style="color: #c20cb9; font-weight: bold;">install</span> php5-devel
phpize <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; configure <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></td></tr></table></div>

<p>open php.ini and make sure you add this line.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"> extension=facedetect.so</pre></div></div>

<p>If facedetect has been successful, you will see this enabled in test.php.</p>
<p><strong>Step 4:</strong> Writing a PHP Script</p>
<p>Copy all xml files in /usr/local/share/opencv/haarcascades folder to the web folder.</p>
<p>Call the php code as shown below, and make sure the path of xml files are correct else you would see a blank face or bool(false) output. Once you get this co-ordinates, you can draw a square or a circle using php gd library.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//face_count() outputs total faces detected</span>
<span style="color: #666666; font-style: italic;">// face_detect() outputs assoc array of x,y,width,height of each face recognized</span>
&nbsp;
<span style="color: #000088;">$total</span><span style="color: #339933;">=</span> face_count<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'test.jpg'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'haarcascade_frontalface_alt.xml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$coord</span><span style="color: #339933;">=</span> face_detect<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'test.jpg'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'haarcascade_frontalface_alt.xml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$coord</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<strong>Share this Post</strong><div id="sharepost" style="padding-top:10px;" >&nbsp;&nbsp;<a href="http://www.facebook.com/share.php?u=http://www.venkysblog.com/2009/11/face-detection-in-php/" target="_blank"><img src="http://www.venkysblog.com/images/shrfb.png" alt="Facebook" /></a>&nbsp;&nbsp;<a href="http://digg.com/submit?url=http://www.venkysblog.com/2009/11/face-detection-in-php/&amp;title=Tutorial: Add face detection to your PHP apps in 4 Steps..&amp;bodytext=&amp;media=&amp;topic=" target="_blank"><img src="http://www.venkysblog.com/images/shrdg.png" alt="Digg It" /></a>&nbsp;&nbsp;<a href="http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=http://www.venkysblog.com/2009/11/face-detection-in-php/&amp;title=Tutorial: Add face detection to your PHP apps in 4 Steps.." target="_blank"><img src="http://www.venkysblog.com/images/shrdl.png" alt="Delicious" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.venkysblog.com/2009/11/face-detection-in-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tutorial: Write your own GTalk custom bot in 10 mins!!</title>
		<link>http://www.venkysblog.com/2009/10/gtalkbots/</link>
		<comments>http://www.venkysblog.com/2009/10/gtalkbots/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 04:29:04 +0000</pubDate>
		<dc:creator>Venky</dc:creator>
				<category><![CDATA[BOTS]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Communication]]></category>
		<category><![CDATA[GTALK]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://www.venkysblog.com/?p=1</guid>
		<description><![CDATA[Chat is where a lot of the us spend our time, almost always for human communication; send the user a message and they respond. A Chat bot is completely automated, that is online 24×7 and will always send &#38; respones to your requests, just like a virtual friend. You can do lot of interesting stuff  like [...]]]></description>
			<content:encoded><![CDATA[<p>Chat is where a lot of the us spend our time, almost always for human communication; send the user a message and they respond. A <strong>Chat bot</strong> is completely automated, that is online 24×7 and will always send &amp; respones to your requests, just like a virtual friend. You can do lot of interesting stuff  like receive alert notifications, post to twitter, book tickets, set reminders, write blogs, and so much more.<br />
<span id="more-92"></span><br />
Lets start writing the <strong>Gtalk custom bot</strong> </p>
<p>Why am I specifically looking at GTalk here? Coz its on open standards &#8211; XMPP !!</p>
<p><strong>Look at some existing Gtalk bots for ideas:</strong></p>
<p><a href="http://www.watblog.com/2009/09/17/5-amazing-twitter-bots-for-gtalk-fans/" target="_blank">Twitter Bots</a>, <a href="http://devakishor.com/2009/03/cleartrips-gtalk-bot-search-book-train-tickets-from-your-ims/" target="_blank">Cleartrip Chatbot</a>, <a href="http://www.business-standard.com/india/news/now-talk-your-way-intojob/351526/" target="_blank">Naukri Chatbot</a>, <a href="http://www.labnol.org/internet/most-useful-google-talk-bots/4347/" target="_blank">Other Useful Chatbots</a></p>
<h3>How to Write your GTalk custom bot in 10 minutes!</h3>
<p><strong>The Solution:</strong> We will write a basic chat bot which will change its status message on our command, using an Opensource Framework <a href="http://code.google.com/p/pygtalkrobot/" target="_blank">PYGtalkRobot.</a> Later, you can expand the idea to more complex tasks like posting to twitter or checking emails etc..</p>
<p><strong>Requirements:</strong><br />
&#8211; Geeky mindset, with basic language skills of python.<br />
&#8211; Linux server running Centos with SSH access<br />
&#8211; 2 Gtalk user accounts.</p>
<p>Lets, Get Started..</p>
<p><strong>Step 1:</strong> Install Python &#8211; 2.4 and above</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> python</pre></div></div>

<p><strong>Step 2:</strong> Download and unpack <a href="http://xmpppy.sf.net" target="_blank">xmpppy</a>.  To install it go into the unpacked directory and run:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">python setup.py <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p><strong>Step 3:</strong> Download and unpack <a href="http://pydns.sourceforge.net/" target="_blank">pydns</a>.  To install it go into the unpacked directory and run:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">python setup.py <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p><strong>Step 4:</strong> Next, Checkout the source code for pygtalkrobot from SVN server:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> checkout http:<span style="color: #000000; font-weight: bold;">//</span>pygtalkrobot.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span>pygtalkrobot<span style="color: #000000; font-weight: bold;">/</span>src pygtalkrobot-read-only</pre></div></div>

<p><strong>Step 5:</strong> The pygtalktrobot directory contains the file:&#8217;sampleRobotcode.py&#8221;. In this file, edit the following lines:</p>
<ul>
<li>In the line, <strong>if jid == &#8216;ldmiao@gmail.com&#8217;:</strong> &#8211; Change &#8216;ldmiao@gmail.com&#8217; to your gtalk id, so that this bot recognizes you as the admin.</li>
<li>In the line, <strong>bot.start(&#8220;account_name@gmail.com&#8221;, &#8220;password&#8221;)</strong> &#8211; Change &#8220;account_name@gmail.com&#8221; &amp; &#8220;password&#8221; to your second gtalk account details through which the bot will login.</li>
</ul>
<p><strong>Step 6:</strong> Run the sampleRobot</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">python sampleRobotcode.py</pre></div></div>

<p>Your sample bot should start running now, and the status should show connected.</p>
<p><strong>Step 7:</strong> Add the gtalk bot user as a friend in your Gtalk Messenger. Gtalk bot will automatically accept you as a friend.</p>
<p><strong>Step 8:</strong> Once added, send the command &#8220;online <strong>GTalk Bot</strong>&#8220;. This will change the status message of the bot to &#8220;GTalk Bot&#8221;.</p>
<p>Hurray!! Your own bot is ready and it responds to the commands..</p>
<strong>Share this Post</strong><div id="sharepost" style="padding-top:10px;" >&nbsp;&nbsp;<a href="http://www.facebook.com/share.php?u=http://www.venkysblog.com/2009/10/gtalkbots/" target="_blank"><img src="http://www.venkysblog.com/images/shrfb.png" alt="Facebook" /></a>&nbsp;&nbsp;<a href="http://digg.com/submit?url=http://www.venkysblog.com/2009/10/gtalkbots/&amp;title=Tutorial: Write your own GTalk custom bot in 10 mins!!&amp;bodytext=&amp;media=&amp;topic=" target="_blank"><img src="http://www.venkysblog.com/images/shrdg.png" alt="Digg It" /></a>&nbsp;&nbsp;<a href="http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=http://www.venkysblog.com/2009/10/gtalkbots/&amp;title=Tutorial: Write your own GTalk custom bot in 10 mins!!" target="_blank"><img src="http://www.venkysblog.com/images/shrdl.png" alt="Delicious" /></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.venkysblog.com/2009/10/gtalkbots/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
