<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Weblog</description><title>Abhishek Singh Bailoo</title><generator>Tumblr (3.0; @abhisheksinghbailoo)</generator><link>http://abhisheksingh.info/</link><item><title>G.729 Codec FreeSWITCH</title><description>&lt;p&gt;Intel G.729 Codec on FreeSWITCH&lt;br/&gt;&lt;br/&gt;            &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;== Introduction == &lt;br/&gt;&lt;br/&gt;Intel Primive Performance (IPP) Library is available at no cost for educational, research and non-commercial purpose.&lt;br/&gt;&lt;br/&gt;We compile a new FreeSWITCH module for G729 codec based on IPP libraries.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;== Method == &lt;br/&gt;&lt;br/&gt;Install Required Packages&lt;br/&gt;  sudo apt-get install build-essential uuid-dev&lt;br/&gt;&lt;br/&gt;The G729 IPP module for Asterisk is better maintained than that of FS. Therefore, we can use asterisk-g72x configure script and resulting Makefile to get proper compile flags for FS.&lt;br/&gt;&lt;br/&gt;  hg clone &lt;a href="https://bitbucket.org/arkadi/asterisk-g72x"&gt;https://bitbucket.org/arkadi/asterisk-g72x&lt;/a&gt;&lt;br/&gt;  cd asterisk-g72x&lt;br/&gt;  ./configure &amp;#8212;with-ipp=/opt/intel/ipp&lt;br/&gt;  make all&lt;br/&gt;&lt;br/&gt;Once we are sure that this compiles without errors, we can use LDFLAGS and other flags from the Makefile for fsg729 module.&lt;br/&gt;&lt;br/&gt;  hg clone &lt;a href="https://code.google.com/p/fs-g729/"&gt;https://code.google.com/p/fs-g729/&lt;/a&gt;&lt;br/&gt;  cd fs-g729&lt;br/&gt;  Change the Makefile to this&lt;br/&gt;  $cat Makefile&lt;br/&gt;    IPPARCH=x86_64&lt;br/&gt;    LARCH=$(IPPARCH)&lt;br/&gt;    CC=cc&lt;br/&gt;    FSBASE=/usr/local/freeswitch&lt;br/&gt;    IPPBASE=/opt/intel&lt;br/&gt;    IPPCORE=m7&lt;br/&gt;&lt;br/&gt;    CC_OPT=-fPIC -O3 -DIPPCORE_STATIC_INIT -DG729A_ENABLE -fomit-frame-pointer -march=native -fno-exceptions&lt;br/&gt;&lt;br/&gt;    INCLUDE=-I$(IPPBASE)/ipp/include -include &amp;#8220;$(IPPBASE)/ipp/tools/intel64/staticlib/ipp_$(IPPCORE).h&amp;#8221; -I$(FSBASE)/include -I$(FSBASE)/libs/libteletone/src&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;    LDFLAGS =-Wl,-static -L&amp;#8221;$(IPPBASE)/ipp/lib/intel64&amp;#8221; -L&amp;#8221;$(IPPBASE)/lib/intel64&amp;#8221; -avoid-version -module  -lippsc_l -lipps_l -lippcore_l&lt;br/&gt;&lt;br/&gt;    all&amp;#160;: decg729.o encg729.o owng729.o vadg729.o aux_tbls.o libg729.o mod_ipp_g729.o&lt;br/&gt;    $(CC) $(INCLUDE) -shared -O2 -Wall -Xlinker -x -o mod_ipp_g729.so  \&lt;br/&gt;        mod_ipp_g729.o libg729.o decg729.o encg729.o owng729.o vadg729.o aux_tbls.o \&lt;br/&gt;       -lm $(LDFLAGS) -L/usr/local/lib -Wl,-Bdynamic $(FSBASE)/lib/libfreeswitch.so -pthread -lrt -luuid -lcrypt&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;    decg729.o&amp;#160;: decg729.c&lt;br/&gt;     $(CC) $(CC_OPT) -c decg729.c $(INCLUDE)&lt;br/&gt;    encg729.o&amp;#160;: encg729.c&lt;br/&gt;     $(CC) $(CC_OPT) -c encg729.c $(INCLUDE)&lt;br/&gt;    owng729.o&amp;#160;: owng729.c&lt;br/&gt;     $(CC) $(CC_OPT) -c owng729.c $(INCLUDE)&lt;br/&gt;    vadg729.o&amp;#160;: vadg729.c&lt;br/&gt;     $(CC) $(CC_OPT) -c vadg729.c $(INCLUDE)&lt;br/&gt;    aux_tbls.o&amp;#160;: aux_tbls.c&lt;br/&gt;    $(CC) $(CC_OPT) -c aux_tbls.c $(INCLUDE)&lt;br/&gt;&lt;br/&gt;    libg729.o: libg729.c&lt;br/&gt;     $(CC) $(CC_OPT) -c libg729.c $(INCLUDE)&lt;br/&gt;    mod_ipp_g729.o: mod_ipp_g729.c&lt;br/&gt;     $(CC) $(CC_OPT) -c mod_ipp_g729.c $(INCLUDE)&lt;br/&gt;&lt;br/&gt;    clean:&lt;br/&gt;     rm -rf *.o *.so&lt;br/&gt;&lt;br/&gt;    make clean&lt;br/&gt;    make all&lt;br/&gt;&lt;br/&gt;This should compile without errors.&lt;br/&gt;&lt;br/&gt;After compiling module fs-g729, you will get mod_ipp_g729.so&lt;br/&gt;This is dynamically linked shared object file with the following linking dependencies&lt;br/&gt;&lt;br/&gt;  $ ldd mod_ipp_g729.so&lt;br/&gt;  linux-vdso.so.1 =&amp;gt;  (0x00007fff72da8000)&lt;br/&gt;  libm.so.6 =&amp;gt; /lib/libm.so.6 (0x00007f9387a77000)&lt;br/&gt;  libfreeswitch.so.1 =&amp;gt; not found&lt;br/&gt;  librt.so.1 =&amp;gt; /lib/librt.so.1 (0x00007f938786e000)&lt;br/&gt;  libuuid.so.1 =&amp;gt; /lib/libuuid.so.1 (0x00007f9387669000)&lt;br/&gt;  libcrypt.so.1 =&amp;gt; /lib/libcrypt.so.1 (0x00007f9387430000)&lt;br/&gt;  libpthread.so.0 =&amp;gt; /lib/libpthread.so.0 (0x00007f9387212000)&lt;br/&gt;  libc.so.6 =&amp;gt; /lib/libc.so.6 (0x00007f9386e8f000)&lt;br/&gt;  /lib64/ld-linux-x86-64.so.2 (0x00007f9387f86000)&lt;br/&gt;&lt;br/&gt;As can be seen the dependency of libfreeswitch.so.1 is not satisfied. This is because although libfreeswitch.so.1 is present in /usr/local/freeswitch/lib but this directory is not present in the link library path.&lt;br/&gt;Put export LD_LIBRARY_PATH=&amp;#8221;$LD_LIBRARY_PATH:/usr/local/freeswitch/lib&amp;#8221; in .bashrc&lt;br/&gt;After that, check again with ldd to confirm that all linking dependencies are satisfied. If anything is still missing, you may need to apt-get install the concerned development library. For instance, sudo apt-get install build-essential uuid-dev etc.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;  cp mod_ipp_g729.so /usr/local/freeswith/mod&lt;br/&gt;  chown -R freeswitch.freeswith /usr/local/freeswith&lt;br/&gt;  fs_cli&amp;gt;reload mod_ipp_g729.so&lt;br/&gt;  fs_cli&amp;gt;show codec&lt;br/&gt;  &lt;br/&gt;The result shold contain&lt;br/&gt;&lt;br/&gt;  codec,G.729 IPP Based,mod_ipp_g729&lt;br/&gt;  codec,G.729 for broken devices (G729A SDP),mod_ipp_g729&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;== Intel IPP Samples: G729 Encoder and Decoder == &lt;br/&gt;&lt;br/&gt;  tar xvzf l_ipp-samples_p_7.0.6.046.tgz&lt;br/&gt;  cd ipp-samples/&lt;br/&gt;  cd speech-codecs/&lt;br/&gt;  export IPPROOT=”/opt/intel/ipp”&lt;br/&gt;  export LD_LIBRARY_PATH=”/opt/intel/ipp/lib/intel64/:/opt/intel/lib/intel64/”&lt;br/&gt;  ldconfig (or sudo ldconfig)&lt;br/&gt;  ./build_intel64.sh&lt;br/&gt;  export PATH=&amp;#8221;$PATH:$HOME/g729/ipp-samples/speech-codecs/_bin/intel64_gcc4/bin/”&lt;br/&gt;&lt;br/&gt;To encode to G729A&lt;br/&gt;  usc_speech_codec -n -format IPP_G729A foo.wav foo.g729a&lt;br/&gt;&lt;br/&gt;To decode from G729A&lt;br/&gt;  usc_speech_codec -n foo.g729a foo.wav&lt;br/&gt;&lt;br/&gt;There is a 10x reduction in size form wav to g729a&lt;br/&gt;  ivr-welcome_to_freeswitch.wav 41840&lt;br/&gt;  ivr-welcome_to_freeswitch.g729a 4224&lt;br/&gt;&lt;br/&gt;ISSUE: This does not seem to work, the resulting g729 coded files are not being played by the ipp_g729 module in FS.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;== Results == &lt;br/&gt;&lt;br/&gt;You will see the following in the logs&lt;br/&gt;  v=0&lt;br/&gt;  o=FreeSWITCH 1326125840&amp;#160;1326125841 IN IP4&amp;#160;10.251.139.73&lt;br/&gt;  s=FreeSWITCH&lt;br/&gt;  c=IN IP4&amp;#160;10.251.139.73&lt;br/&gt;  t=0&amp;#160;0&lt;br/&gt;  m=audio 29294 RTP/AVP 18&amp;#160;96&lt;br/&gt;  a=rtpmap:18 G729/8000&lt;br/&gt;  a=fmtp:18 annexb=no&lt;br/&gt;  a=rtpmap:96 telephone-event/8000&lt;br/&gt;  a=fmtp:96&amp;#160;0-16&lt;br/&gt;  a=silenceSupp:off - - - -&lt;br/&gt;  a=ptime:20&lt;br/&gt;  a=sendrecv&lt;br/&gt;&lt;br/&gt;  sofia_glue.c:4727 Audio Codec Compare [G729:18:8000:20:8000]/[G7221:115:32000:20:48000]&lt;br/&gt;  sofia_glue.c:4727 Audio Codec Compare [G729:18:8000:20:8000]/[G7221:107:16000:20:32000]&lt;br/&gt;  sofia_glue.c:4727 Audio Codec Compare [G729:18:8000:20:8000]/[G729:18:8000:20:8000]&lt;br/&gt;  switch_core_state_machine.c:380 (sofia/external/+6285368033158@10.251.138.4) State NEW&lt;br/&gt;  sofia_glue.c:2848 Set Codec sofia/external/+6285368033158@10.251.138.4 G729/8000&amp;#160;20&amp;#160;ms 160 samples 8000 bits&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;Tested on Quad core AMD machine with 2&amp;#160;GB RAM for 750 concurrent calls.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;== More Work == &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;== References ==&lt;br/&gt;&lt;br/&gt;&lt;a href="https://code.google.com/p/fs-g729/"&gt;https://code.google.com/p/fs-g729/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://code.google.com/p/fsg729/"&gt;http://code.google.com/p/fsg729/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="https://bitbucket.org/arkadi/asterisk-g72x"&gt;https://bitbucket.org/arkadi/asterisk-g72x&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://asterisk.hosting.lv/"&gt;http://asterisk.hosting.lv/&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.readytechnology.co.uk/open/ipp-codecs-g729-g723.1/"&gt;http://www.readytechnology.co.uk/open/ipp-codecs-g729-g723.1/&lt;/a&gt;&lt;/p&gt;</description><link>http://abhisheksingh.info/post/16865392387</link><guid>http://abhisheksingh.info/post/16865392387</guid><pubDate>Wed, 01 Feb 2012 10:23:23 -0500</pubDate></item><item><title>FreeSWITCH Timing</title><description>&lt;h3&gt;&lt;span class="mw-headline" id="Timing"&gt;&lt;br/&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;FS maintains its own clock because system clock can change suddenly. If NTP is enabled on your server then FS should be synced with system clock at least once every day or once every hour, as the need may be.&lt;/p&gt;
&lt;p&gt;Use command fsctl sync_clock More details here &lt;a class="external free" href="http://wiki.freeswitch.org/wiki/Mod_commands" rel="nofollow"&gt;&lt;a href="http://wiki.freeswitch.org/wiki/Mod_commands"&gt;http://wiki.freeswitch.org/wiki/Mod_commands&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;To get the current time here freeswitch command&lt;/p&gt;
&lt;p&gt;fs_cli -x &amp;#8220;strftime_tz Asia/Kolkata %Y-%m-%d %T&amp;#8221; &amp;amp;&amp;amp; date&lt;/p&gt;
&lt;p&gt;Put a script also placed in /etc/cron.hourly/time-update.sh which update time hourly on child machine.&lt;/p&gt;
&lt;p&gt;!/bin/bash&lt;/p&gt;
&lt;p&gt;/usr/sbin/ntpdate 10.0.0.70 /usr/local/freeswitch/bin/fs_cli -x &amp;#8220;fsctl sync_clock&amp;#8221; exit 0&lt;/p&gt;
&lt;p&gt;Anthony Minnesale says:&lt;/p&gt;
&lt;p&gt;Allowing any software to trust the system time is very dangerous. Something that was depending on the system time to calculate a duration etc can be considerably compromised if the time suddenly changes by hours or years in either direction. Things like daylights savings time can break CDR etc.&lt;/p&gt;
&lt;p&gt;The clock in FS is the onboard monotonic clock and the offset to real time is preserved. If you want FS to sync to system time when desired there are commands to perform this operation.&lt;/p&gt;</description><link>http://abhisheksingh.info/post/16865305067</link><guid>http://abhisheksingh.info/post/16865305067</guid><pubDate>Wed, 01 Feb 2012 10:20:00 -0500</pubDate></item><item><title>Install FreeSWITCH on CentOS</title><description>&lt;p&gt;yum install libtool bison libjpeg-devel&lt;/p&gt;
&lt;p&gt;git clone git://git.freeswitch.org/freeswitch.git&lt;/p&gt;
&lt;p&gt;cd freeswitch&lt;/p&gt;
&lt;p&gt;./bootstrap.sh&lt;/p&gt;
&lt;p&gt;./configure&lt;/p&gt;
&lt;p&gt;Edit modules.conf and uncomment any commented module that you might need. For eg, Flite and UniMRCP for TTS and ASR, etc.&lt;/p&gt;
&lt;p&gt;make &amp;amp;&amp;amp; make install&lt;/p&gt;
&lt;p&gt;make sounds-install moh-install&lt;/p&gt;
&lt;p&gt;cp build/freeswitch.init.redhat /etc/init.d/freeswitch&lt;/p&gt;
&lt;p&gt;Edit /etc/init.d/freeswitch&lt;/p&gt;
&lt;p&gt;PID_FILE=${PID_FILE-/usr/local/freeswitch/log/freeswitch.pid}&lt;br/&gt;FS_USER=${FS_USER-freeswitch}&lt;br/&gt;FS_FILE=${FS_FILE-/usr/local/freeswitch/bin/freeswitch}&lt;br/&gt;FS_HOME=${FS_HOME-/usr/local/freeswitch}&lt;/p&gt;
&lt;p&gt;chmod 755 /etc/init.d/freeswitch&lt;/p&gt;
&lt;p&gt;chkconfig  &amp;#8212;level 345 freeswitch on&lt;/p&gt;
&lt;p&gt;chkconfig &amp;#8212;list freeswitch&lt;/p&gt;
&lt;p&gt;groupadd freeswitch&lt;/p&gt;
&lt;p&gt;useradd -g freeswitch freeswitch&lt;/p&gt;
&lt;p&gt;chown -R freeswitch.freeswitch /usr/local/freeswitch&lt;/p&gt;</description><link>http://abhisheksingh.info/post/15286037399</link><guid>http://abhisheksingh.info/post/15286037399</guid><pubDate>Wed, 04 Jan 2012 02:01:00 -0500</pubDate></item><item><title>Floating Point Arithmetic in Shell</title><description>&lt;p&gt;echo &amp;#8220;scale=2; 2.51+2.51&amp;#8221; | bc&lt;br/&gt; 5.02&lt;/p&gt;</description><link>http://abhisheksingh.info/post/14926438742</link><guid>http://abhisheksingh.info/post/14926438742</guid><pubDate>Wed, 28 Dec 2011 13:23:54 -0500</pubDate></item><item><title>CentOS Asterisk iptables</title><description>&lt;p&gt;Add the following rules to /etc/sysconfig/iptables&lt;/p&gt;
&lt;p&gt;-A INPUT -i lo -j ACCEPT &lt;br/&gt;-A INPUT -m state &amp;#8212;state RELATED,ESTABLISHED -j ACCEPT &lt;br/&gt;-A INPUT -p tcp -m tcp &amp;#8212;dport 22 -j ACCEPT &lt;br/&gt;-A INPUT -p udp -m udp &amp;#8212;dport 5060 -j ACCEPT &lt;br/&gt;-A INPUT -p udp -m udp &amp;#8212;dport 10000:20000 -j ACCEPT &lt;br/&gt;-A INPUT -p udp -m udp &amp;#8212;dport 4000:4999 -j ACCEPT &lt;br/&gt;-A INPUT -p udp -m udp &amp;#8212;dport 4569 -j ACCEPT &lt;br/&gt;-A INPUT -p tcp -m tcp &amp;#8212;dport 5038 -j ACCEPT &lt;br/&gt;-A INPUT -p udp -m udp &amp;#8212;dport 10000:20000 -j ACCEPT &lt;br/&gt;-A INPUT -p tcp -m state &amp;#8212;state NEW -m tcp &amp;#8212;dport 80 -j ACCEPT &lt;br/&gt;-A INPUT -p tcp -m state &amp;#8212;state NEW -m tcp &amp;#8212;dport 443 -j ACCEPT &lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;p&gt;#service iptables restart&lt;/p&gt;
&lt;p&gt;Hint: iptables-save does NOT save to /etc/sysconfig/iptables&lt;/p&gt;
&lt;p&gt;To do that use&lt;/p&gt;
&lt;p&gt;#service iptables save&lt;/p&gt;</description><link>http://abhisheksingh.info/post/14603411288</link><guid>http://abhisheksingh.info/post/14603411288</guid><pubDate>Thu, 22 Dec 2011 00:19:59 -0500</pubDate></item><item><title>Shell Remove blank space filenames</title><description>&lt;p&gt;find | while read fname; do newname=`echo $fname | sed -e &amp;#8216;s/ /_/g&amp;#8217;`; mv &amp;#8220;$fname&amp;#8221; &amp;#8220;$newname&amp;#8221;; done&lt;/p&gt;</description><link>http://abhisheksingh.info/post/11153589835</link><guid>http://abhisheksingh.info/post/11153589835</guid><pubDate>Fri, 07 Oct 2011 17:48:49 -0400</pubDate></item><item><title>Linux Format new Hard Disk</title><description>&lt;p&gt;Source: &lt;a href="http://www.ehow.com/how_1000631_hard-drive-linux.html"&gt;http://www.ehow.com/how_1000631_hard-drive-linux.html&lt;/a&gt;&lt;/p&gt;
&lt;ol id="intelliTxt" class="steps"&gt;&lt;li class="section"&gt;
&lt;h2 class="header Heading3"&gt;Preparation&lt;/h2&gt;
&lt;ul&gt;&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;1&lt;/span&gt;
&lt;p&gt;When you format a computer hard  drive, you will lose everything that is on the drive. Therefore, it is  very important to back up anything you might later want.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;2&lt;/span&gt;
&lt;p&gt;To format a secondary drive, you  will need root access. All commands used in this tutorial are run from a  command line (terminal) as root. You may also want to make note of the  size (total capacity in MB) of the drive.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;3&lt;/span&gt;
&lt;p&gt;Linux refers to hard drives as  either &amp;#8220;hdx&amp;#8221; or &amp;#8220;sdx,&amp;#8221; where x is a letter, starting with a, which  represents the order in which the drive was added to or detected by the  computer. The &amp;#8220;hd&amp;#8221; prefix is used for IDE and PATA (formerly just ATA),  and the &amp;#8220;sd&amp;#8221; prefix is used for SCSI, SATA and USB drives. Usually, a  number is also put at the end of &amp;#8220;hdx&amp;#8221; or &amp;#8220;sdx&amp;#8221; to denote different  partitions on the same physical drive, but for the purpose of  formatting, you only need to know which letter the drive you want to  format is.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;4&lt;/span&gt;
&lt;p&gt;The examples given in this  how-to are for a computer with two IDE hard drives attached as a master  and slave. In this, the drives are &amp;#8220;hda&amp;#8221; and &amp;#8220;hdb.&amp;#8221; You will need to  determine the letter of the drive you want to format for your own setup.  We will be formatting the drive hdb. For all examples, replace &amp;#8220;hdb&amp;#8221;  with whatever your drive designation is.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;5&lt;/span&gt;
&lt;p&gt;You can see all the drives  attached to your system by typing the command &amp;#8220;ls /dev/hd*&amp;#8221; or  &amp;#8220;ls  /dev/sd*&amp;#8221;, depending on which type (IDE, SATA and so forth) the drives  are. On the example system, the result of this command looks like  &amp;#8220;/dev/hda  /dev/hda1 /dev/hda2 /dev/hdb /dev/hdb1&amp;#8221;.  The operating  system is installed on hda, which has two partitions (hda1 and hda2),  and there is one partition on hdb and hdb1.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;h2 class="header Heading3"&gt;Using fdisk&lt;/h2&gt;
&lt;ul&gt;&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;1&lt;/span&gt;
&lt;p&gt;First, you will use the fdisk  command to erase any old partitions on the drive and create a new one.  Any changes you make using fdisk are only made permanent if you then  issue the &amp;#8220;w&amp;#8221; command before quitting, so feel free to play around a  little if you like. If at any time you find yourself stuck, you can quit  the program without saving changes by holding the &amp;#8220;Ctrl&amp;#8221; key and  pressing &amp;#8220;c.&amp;#8221;&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;2&lt;/span&gt;
&lt;p&gt;At the command prompt, type  &amp;#8220;fdisk /dev/hdb&amp;#8221;, replacing the &amp;#8220;hdb&amp;#8221; with the letters for your drive.  Upon opening, fdisk may give you a couple of warnings, all of which can  be ignored. It then gives you a prompt that looks like this: Command (m  for help):&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;3&lt;/span&gt;
&lt;p&gt;Enter &amp;#8220;p&amp;#8221; to see the partition  table of the drive. The first line of output from the &amp;#8220;p&amp;#8221; command will  also tell you the size of the drive. This is a good way to double-check  that you are working with the correct drive.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;4&lt;/span&gt;
&lt;p&gt;If there are any partitions  already on the drive, they will be listed as the last lines of the &amp;#8220;p&amp;#8221;  command. On our example, this looks like &amp;#8220;/dev/hdb1&amp;#8221;, followed by some  information about the partition&amp;#8217;s size and filesystem.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;5&lt;/span&gt;
&lt;p&gt;To delete any existing  partitions, press &amp;#8220;d&amp;#8221; and then &amp;#8220;Enter.&amp;#8221; It will ask you which partition  number you wish to delete. The number of the partition is the number  that follows hdb, so on our example system, we enter 1. If there are  multiple partitions, repeat the &amp;#8220;d&amp;#8221; command for each one. You can always  view the partition table again with the &amp;#8220;p&amp;#8221; command.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;6&lt;/span&gt;
&lt;p&gt;Once you have deleted all  existing partitions on the drive, you are ready to make a new one. Type  &amp;#8220;n&amp;#8221; and hit &amp;#8220;Enter.&amp;#8221; Then press &amp;#8220;p&amp;#8221; to create a primary partition. It  asks you for a partition number; enter &amp;#8220;1.&amp;#8221; Now you are asked which  cylinder the partition should start at. The beginning of the drive is  the default, so just hit &amp;#8220;Enter.&amp;#8221; Then, you are asked for the last  cylinder. The end of the drive is the default, so you can just press  &amp;#8220;Enter&amp;#8221; again.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;7&lt;/span&gt;
&lt;p&gt;Now you are back at fdisk&amp;#8217;s  command prompt. Use the &amp;#8220;p&amp;#8221; command to check the partition table. You  should now see your new partition at the bottom of the output. In the  example, it lists as &amp;#8220;/dev/hdb1.&amp;#8221;&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;8&lt;/span&gt;
&lt;p&gt;You now need to set the  filesystem type for your new partition with the &amp;#8220;t&amp;#8221; command. You are  asked for the Hex code of the filesystem you wish to use. We will use  the standard Linux ext2 filesystem, which is &amp;#8220;83.&amp;#8221; If you are doing  something special and know of a particular filesystem that you need to  use, you can press &amp;#8220;L&amp;#8221; to see all the codes, which are one or two  characters made up of the numbers 0 to 9 and the letters a to f.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;9&lt;/span&gt;
&lt;p&gt;Now just issue the &amp;#8220;w&amp;#8221; command to write your new partition table and exit fdisk.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;h2 class="header Heading3"&gt;Creating the New Filesystem With mkfs&lt;/h2&gt;
&lt;ul&gt;&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;1&lt;/span&gt;
&lt;p&gt;Now you need to create the filesystem on the drive. This is done with the &amp;#8220;mkfs&amp;#8221; command.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;2&lt;/span&gt;
&lt;p&gt;At the command prompt, enter  &amp;#8220;mkfs -t ext2 /dev/hdb1&amp;#8221;, while remembering to change the hdb1 to  whatever the letters are for the partition you just created.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;3&lt;/span&gt;
&lt;p&gt;If you are using a different filesystem than ext2, you will have to specify that where &amp;#8220;ext2&amp;#8221; is in the above command.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;h2 class="header Heading3"&gt;Finalizing the Format With fsck&lt;/h2&gt;
&lt;ul&gt;&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;1&lt;/span&gt;
&lt;p&gt;All that is left is to run a  check on the drive and enter it into your fstab so that the drive mounts  each time you start your computer. This can be done with a single fsck  command.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;2&lt;/span&gt;
&lt;p&gt;At the command prompt, type &amp;#8220;fsck -f -y /dev/hdb1&amp;#8221;, again replacing hdb1 with the letters and number for your partition.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;3&lt;/span&gt;
&lt;p&gt;After fsck runs, your new drive is formatted. Restart your system before using it.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt; &lt;span class="stepNumber"&gt;4&lt;/span&gt;
&lt;p&gt;If you reformatted your system drive, you will now need to boot off an installation disk to install an operating system.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="step"&gt;Edit /etc/fstab and add the following line&lt;/li&gt;
&lt;li class="step"&gt;
&lt;pre&gt;/dev/sdb1               /media                  ext3    defaults        1 2&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ol&gt;</description><link>http://abhisheksingh.info/post/11134945962</link><guid>http://abhisheksingh.info/post/11134945962</guid><pubDate>Fri, 07 Oct 2011 04:35:00 -0400</pubDate></item><item><title>CentOS Install SugarCRM</title><description>&lt;p&gt;yum install php-mbstrings php-imap&lt;/p&gt;
&lt;p&gt;Edit /etc/php.ini&lt;/p&gt;
&lt;p&gt;memory_limit = 48MB&lt;/p&gt;
&lt;p&gt;upload_max_filesize = 12M&lt;/p&gt;
&lt;p&gt;/etc/init.d/httpd restart&lt;/p&gt;
&lt;p&gt;chown -R apache.apache /var/www/html/*&lt;/p&gt;

&lt;p&gt;In order to run SugarCRM schedulers add the following line in crontab&lt;/p&gt;
&lt;p&gt;*    *    *    *    *     						cd /var/www/html/SugarCE-Full-6.3.0RC1; php -f cron.php &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;/p&gt;</description><link>http://abhisheksingh.info/post/11062192248</link><guid>http://abhisheksingh.info/post/11062192248</guid><pubDate>Wed, 05 Oct 2011 11:39:00 -0400</pubDate></item><item><title>Mysql change user password</title><description>&lt;p&gt;Source: &lt;a href="http://www.cyberciti.biz/faq/mysql-change-user-password/"&gt;http://www.cyberciti.biz/faq/mysql-change-user-password/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;First,  login to MySQL server, type following command at shell prompt to login as root&lt;br/&gt;&lt;code&gt;$ mysql -u root -p&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;2) Use mysql database (type command at mysql&amp;gt; prompt, do not include string &amp;#8220;mysql&amp;gt;&amp;#8221;):&lt;br/&gt;&lt;code&gt;mysql&amp;gt;&lt;strong&gt; use mysql;&lt;/strong&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;3) Change password for user tom:&lt;br/&gt;&lt;code&gt;mysql&amp;gt; &lt;strong&gt;update user set password=PASSWORD("&lt;span&gt;NEW-PASSWORD-HERE&lt;/span&gt;") where User='&lt;span&gt;tom&lt;/span&gt;';&lt;/strong&gt;&lt;/code&gt;&lt;/p&gt;</description><link>http://abhisheksingh.info/post/11062001052</link><guid>http://abhisheksingh.info/post/11062001052</guid><pubDate>Wed, 05 Oct 2011 11:30:30 -0400</pubDate></item><item><title>Install ffmpeg centos</title><description>&lt;p&gt;Source: &lt;a href="http://www.boonex.com/n/How_to_install_ffmpeg_on_centos_5"&gt;http://www.boonex.com/n/How_to_install_ffmpeg_on_centos_5&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The most easy way to install ffmpeg in CentOS is with yum.&lt;br/&gt; First of all, edit /etc/yum.repos.d/CentOS-Base.repo and add those lines at bottm of file:&lt;br/&gt; [dag]&lt;br/&gt; name=Dag RPM Repository for Centos&lt;br/&gt; baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag&lt;/p&gt;
&lt;p&gt;gpgcheck=0&lt;/p&gt;
&lt;p&gt;enabled=1&lt;/p&gt;
&lt;p&gt;&lt;br/&gt; Then, run command:&lt;br/&gt; yum install ffmpeg&lt;br/&gt;&lt;br/&gt; Or, you can install from svn:&lt;br/&gt;&lt;br/&gt; svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg&lt;br/&gt;&lt;br/&gt; cd ffmpeg&lt;br/&gt; ./configure &amp;#8212;help&lt;br/&gt;&lt;br/&gt; add some parameters, like &amp;#8212;enable-gpl, &amp;#8212;enable-libmp3lame, etc..&lt;br/&gt;&lt;br/&gt; make&lt;span&gt; &amp;amp;&amp;amp; make install&lt;br/&gt;&lt;br/&gt; (if svn command not found, type yum install subversion)&lt;/span&gt;&lt;/p&gt;</description><link>http://abhisheksingh.info/post/11021104473</link><guid>http://abhisheksingh.info/post/11021104473</guid><pubDate>Tue, 04 Oct 2011 10:32:00 -0400</pubDate></item><item><title>Asterisk iptables</title><description>&lt;p&gt;Source: &lt;a href="http://www.selbytech.com/2010/04/how-to-setup-iptables-for-asterisk-1-6-2-on-centos-5-4/"&gt;http://www.selbytech.com/2010/04/how-to-setup-iptables-for-asterisk-1-6-2-on-centos-5-4/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;First things first, I want to point out, if you’re not careful when  you’re setting up your iptables settings, there’s a very real  possibility of blocking all remote access to your server.  If you’re  working on your server remotely, be very careful, and be sure to read  all of this article before proceeding!&lt;/p&gt;
&lt;p&gt;First, let’s make sure we’ve already got iptables installed on our  box.  It should be installed by default on most CentOS 4.x and 5.x  installs.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# rpm -q iptables
iptables-1.3.5-5.3.el5_4.1

# lsmod | grep ip_tables
ip_tables              17029  1 iptable_filter
x_tables               17349  5 xt_state,ip_tables,ip6t_REJECT,xt_tcpudp,ip6_tables&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With that out of the way, we can look at how iptables is currently  setup, using the “iptables -L” command.  The following should be the  default rules on a fresh CentOS 5.4 install.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere
ACCEPT     icmp --  anywhere             anywhere            icmp any
ACCEPT     esp  --  anywhere             anywhere
ACCEPT     ah   --  anywhere             anywhere
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If for some reason iptables isn’t running yet, you can enable it by running&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# system-config-securitylevel&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, the defaults are fine and good for defaults, but they aren’t  really what we’re looking for.  So at this point we’re going to clear  them out, and setup a very basic default set of access rules.  I like to  use the basic ruleset from the CentOS wiki, located &lt;a title="CentOS IPTables How-To" target="_blank" href="http://wiki.centos.org/HowTos/Network/IPTables"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# iptables -P INPUT ACCEPT
# iptables -F
# iptables -A INPUT -i lo -j ACCEPT
# iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# iptables -A INPUT -p tcp --dport 22 -j ACCEPT
# iptables -P INPUT DROP
# iptables -P FORWARD DROP
# iptables -P OUTPUT ACCEPT&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let’s take a look at what we did here:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iptables -P INPUT ACCEPT&lt;/strong&gt; – This sets the default  policy on the input chain to ACCEPT, so we don’t lock ourselves out if  we’re connected remotely via ssh.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iptables -F&lt;/strong&gt; – This is the command to flush the  current rule set and only use the defaults (which we just set to ACCEPT  on inbound connections, which gives us a blank slate to work with  without locking us out of our own box).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iptables -A INPUT -i lo -j ACCEPT&lt;/strong&gt; – This is a simple  rule to allow all access from the loopback adapter.  The -A switch  means we’re Appending a new rule to the chain.  -i means this rule has  to do with all traffic flowing through a network interface (in this  case, the lo, or loopback, interface).  -j means to Jump to the ACCEPT  action.  A lot of applications expect to be able to talk with the  loopback adapter, so be sure to include this rule.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT&lt;/strong&gt; – You should already recognize some parts of this line.  What’s new  here is the -m switch, which we use to load a module (in this case, the  ‘state’ module). The state module is able to examine the state of a  packet and determine if it is NEW, ESTABLISHED or RELATED. NEW refers to  incoming packets that are new incoming connections that weren’t  initiated by the host system. ESTABLISHED and RELATED refers to incoming  packets that are part of an already established connection or related  to an already established connection.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iptables -A INPUT -p tcp –dport 22 -j ACCEPT&lt;/strong&gt; – This  rule is a very important rule, at least it’s important if you’re  connecting remotely!  This rule is appended to the INPUT chain and says  that any packets coming in on the tcp protocol (-p), on port 22 (–dport  22), should be accepted.  Port 22 is of course the default ssh port.  If  you’ve changed your ssh port in your sshd_config, you would of course  alter this line accordingly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iptables -P INPUT DROP&lt;/strong&gt; – Remember our first rule?   When we set the default policy for the INPUT chain to ACCEPT?  This line  changes the default policy for the INPUT chain back to DROP, which is  what is required if you want to actually block traffic coming into your  server.  If you correctly set the previous line to allow ssh traffic,  you shouldn’t lock yourself out at this point.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iptables -P FORWARD DROP&lt;/strong&gt; – This rule is pretty much  the same as the previous one, except that we’re setting the default  policy for the FORWARD chain, which handles traffic flowing through our  system from one interface to another (i.e if you’re using your server as  a router, which in this case we’re not).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iptables -P OUTPUT ACCEPT&lt;/strong&gt; – And finally, this rule allows all traffic to flow outwards from your server.&lt;/p&gt;
&lt;p&gt;Now that we’ve got these new rules, we should save them so that they’re applied the next time we restart the iptables service.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# iptables-save&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# service iptables save&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you want to learn more about iptables and the various switches available to you, I recommend you read the &lt;a title="CentOS IPTables How-To" target="_blank" href="http://wiki.centos.org/HowTos/Network/IPTables"&gt;IPTables How-To on the CentOS wiki&lt;/a&gt; I linked to earlier.  There’s a lot of useful information there.&lt;/p&gt;
&lt;p&gt;Now, if you want to run asterisk on your server that you’ve got  protected with IPTables, you’ll need to setup a few specific rules.   Let’s go over those here:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# iptables -A INPUT -p udp -m udp --dport 5060 -j ACCEPT
# iptables -A INPUT -p udp -m udp --dport 10000:20000 -j ACCEPT
# iptables -A INPUT -p udp -m udp --dport 4000:4999 -j ACCEPT
# iptables -A INPUT -p udp -m udp --dport 4569 -j ACCEPT
# iptables -A INPUT -p tcp -m tcp --dport 5038 -j ACCEPT&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let’s take a look at what we’re doing here:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iptables -A INPUT -p udp -m udp –dport 5060 -j ACCEPT&lt;/strong&gt; – This rule and the next are needed if you have SIP endpoints or a SIP  connection to your ITSP.  UDP port 5060 is the port used for SIP  traffic.  If you don’t want to accept SIP traffic from anyone, anywhere,  you can further restrict this line by adding source IP addresses or  networks with the -s switch:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# iptables -A INPUT -p udp -m udp -s 172.19.240.24 --dport 5060 -j ACCEPT
# iptables -A INPUT -p udp -m udp -s 172.23.129.58 --dport 5060 -j ACCEPT
# iptables -A INPUT -p udp -m udp -s 172.36.15.0/24 --dport 5060 -j ACCEPT&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;iptables -A INPUT -p udp -m udp –dport 10000:20000 -j ACCEPT&lt;/strong&gt; – This rule goes hand in hand with the previous rule.  This is the rule  that allows RTP traffic.  By default, asterisk uses a large range of  rtp ports to establish rtp connections, and you have to set a large  range of udp ports as well.  If you’re uncomfortable with this idea, you  can trim down on the number of ports used for your RTP traffic in  asterisk’s /etc/asterisk/rtp.conf file.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# cat /etc/asterisk/rtp.conf
[general]
rtpstart=10000
rtpend=10050

# iptables -A INPUT -p udp -m udp --dport 10000:10050 -j ACCEPT&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A good rule of thumb is to have 4 ports per concurrent call you plan  on having flow through your system, plus 10% for breathing room.  So if  you plan on having at most 10 concurrent calls on your system at any  time, configure asterisk to use 44 ports (10 calls x 4 ports = 40, 40 *  1.10 = 44).  Be sure the range in your firewall matches the range in  your rtp.conf file.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iptables -A INPUT -p udp -m udp –dport 4000:4999 -j ACCEPT&lt;/strong&gt; – This rule is used to allow udptl traffic, which is a T.38 transport  protocol.  If you don’t plan on doing faxing, you can skip this rule.  I  don’t have any handy rules of thumb for the number of udptl ports used  per T.38 fax, so you may want to leave this rule at it’s default.  You  can try changing it down, but until I hear otherwise from the folks at  Digium, I’ll leave the defaults as the recommended.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iptables -A INPUT -p udp -m udp –dport 4569 -j ACCEPT&lt;/strong&gt; – This rule is for IAX2 connections.  IAX2 is another VoIP protocol,  much like SIP.  Unlike SIP, it only needs one port open on your firewall  for both control traffic and audio / data traffic.  You don’t need to  open any ranges of ports to allow multiple concurrent calls using IAX2  either, as it’s all handled through the one port.  If you plan on making  any IAX2 connections through your firewall, be sure to open this port.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;iptables -A INPUT -p tcp –dport 5038 -j ACCEPT&lt;/strong&gt; –  This rule is to allow connections to the Asterisk Manager Interface, or  AMI.  If you’re not accessing AMI remotely, you should leave this rule  off your firewall.&lt;/p&gt;
&lt;p&gt;Now that you’ve got your rules in place, go ahead and test your  system.  If everything seems to be working properly, save your new rules  to your iptables config by running one of the following commands:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# iptables-save&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# service itpables save&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And that’s it!  You should be all set now.  If you have any questions, please feel free to leave a comment below.&lt;/p&gt;
&lt;p&gt;Next week we’ll cover using Fail2Ban along with IPTables to secure your asterisk server from malicious and costly attacks.&lt;/p&gt;</description><link>http://abhisheksingh.info/post/10994298584</link><guid>http://abhisheksingh.info/post/10994298584</guid><pubDate>Mon, 03 Oct 2011 18:15:40 -0400</pubDate></item><item><title>Recover MySQL root Password</title><description>&lt;p&gt;Source: &lt;a href="http://www.cyberciti.biz/tips/recover-mysql-root-password.html"&gt;http://www.cyberciti.biz/tips/recover-mysql-root-password.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you simple want to change root password then&lt;/p&gt;
&lt;p&gt;&lt;code&gt;$ mysqladmin -u root password NEWPASSWORD&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Otherwise, if you do not know the root password then&lt;/p&gt;
&lt;p&gt;&lt;span class="drop_cap"&gt;Y&lt;/span&gt;ou can recover MySQL database server password with following five easy steps.&lt;br/&gt;&lt;span id="more-910"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a title="See all UNIX(R) related articles/tips" href="http://www.cyberciti.biz/tips/category/unix"&gt;&lt;br/&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Step # 1: Stop the MySQL server process.&lt;/p&gt;
&lt;p&gt;Step # 2: Start the MySQL (mysqld) server/daemon process with the  &amp;#8212;skip-grant-tables option so that it will not prompt for password.&lt;/p&gt;
&lt;p&gt;Step # 3: Connect to mysql server as the root user.&lt;/p&gt;
&lt;p&gt;Step # 4: Setup new mysql root account password i.e. reset mysql password.&lt;/p&gt;
&lt;p&gt;Step # 5:  Exit and restart the MySQL server.&lt;/p&gt;
&lt;p&gt;Here are commands you need to type for each step (login as the root user):&lt;/p&gt;
&lt;h3&gt;Step # 1&amp;#160;: &lt;a href="http://www.cyberciti.biz/faq/mysql-startup-script-under-bsdlinux/"&gt;Stop mysql service&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;# /etc/init.d/mysql stop&lt;/code&gt;&lt;br/&gt; Output:&lt;/p&gt;
&lt;pre&gt;Stopping MySQL database server: mysqld.&lt;/pre&gt;
&lt;h3&gt;Step # 2: Start to MySQL server w/o password:&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;# mysqld_safe --skip-grant-tables &amp;amp;&lt;/code&gt;&lt;br/&gt; Output:&lt;/p&gt;
&lt;pre&gt;[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started&lt;/pre&gt;
&lt;h3&gt;Step # 3: Connect to mysql server using mysql client:&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;# mysql -u root&lt;/code&gt;&lt;br/&gt; Output:&lt;/p&gt;
&lt;pre&gt;Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log

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

mysql&amp;gt;&lt;/pre&gt;
&lt;h3&gt;Step # 4: &lt;a href="http://www.cyberciti.biz/faq/mysql-change-root-password/"&gt;Setup new MySQL root user password&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;mysql&amp;gt; use mysql;&lt;br/&gt; mysql&amp;gt; update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';&lt;br/&gt; mysql&amp;gt; flush privileges;&lt;br/&gt; mysql&amp;gt; quit&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;Step # 5: Stop MySQL Server:&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;# /etc/init.d/mysql stop&lt;/code&gt;&lt;br/&gt; Output:&lt;/p&gt;
&lt;pre&gt;Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended

[1]+  Done                    mysqld_safe --skip-grant-tables&lt;/pre&gt;
&lt;h3&gt;Step # 6: &lt;a href="http://www.cyberciti.biz/faq/how-do-i-access-mysql-server-from-the-shell-prompt-command-line/"&gt;Start MySQL server and test it&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;# /etc/init.d/mysql start&lt;br/&gt; # mysql -u root -p&lt;/code&gt;&lt;/p&gt;</description><link>http://abhisheksingh.info/post/10977243996</link><guid>http://abhisheksingh.info/post/10977243996</guid><pubDate>Mon, 03 Oct 2011 07:41:00 -0400</pubDate></item><item><title>Install php 5.2 centos</title><description>&lt;p&gt;Source: &lt;a href="http://wiki.centos.org/HowTos/PHP_5.1_To_5.2"&gt;http://wiki.centos.org/HowTos/PHP_5.1_To_5.2&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="head-7a79c4c26d56ec67f7ff8e44140b239159f26750"&gt;Summary&lt;/h2&gt;
&lt;p&gt;&lt;span class="anchor" id="line-9"&gt; &lt;/span&gt;&lt;span class="anchor" id="line-10"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class="line874"&gt;This  guide describes how to upgrade the standard PHP 5.1.x packages in  CentOS 5.x 32-bit to the current development versions 5.2.x. These  instructions were created using CentOS 5.3&amp;#160;32-bit and with the following  PHP packages installed: &lt;span class="anchor" id="line-11"&gt; &lt;/span&gt;&lt;span class="anchor" id="line-12"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;span class="anchor" id="line-13"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;# rpm -qa |grep php
&lt;span class="anchor" id="line-14"&gt; &lt;/span&gt;
&lt;span class="anchor" id="line-15"&gt; &lt;/span&gt; php-common-5.1.6-15.el5.i386
&lt;span class="anchor" id="line-16"&gt; &lt;/span&gt; php-cli-5.1.6-15.el5.i386
&lt;span class="anchor" id="line-17"&gt; &lt;/span&gt; php-5.1.6-15.el5.i386
&lt;span class="anchor" id="line-18"&gt; &lt;/span&gt; php-pdo-5.1.6-15.el5.i386
&lt;span class="anchor" id="line-19"&gt; &lt;/span&gt; php-bcmath-5.1.6-15.el5.i386
&lt;span class="anchor" id="line-20"&gt; &lt;/span&gt; php-ldap-5.1.6-15.el5.i386
&lt;span class="anchor" id="line-21"&gt; &lt;/span&gt; php-devel-5.1.6-15.el5.i386
&lt;span class="anchor" id="line-22"&gt; &lt;/span&gt; php-gd-5.1.6-15.el5.i386
&lt;span class="anchor" id="line-23"&gt; &lt;/span&gt; php-xml-5.1.6-15.el5.i386
&lt;span class="anchor" id="line-24"&gt; &lt;/span&gt; php-mbstring-5.1.6-15.el5.i386
&lt;span class="anchor" id="line-25"&gt; &lt;/span&gt; php-mysql-5.1.6-15.el5.i386
&lt;span class="anchor" id="line-26"&gt; &lt;/span&gt; php-dba-5.1.6-15.el5.i386
&lt;span class="anchor" id="line-27"&gt; &lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="anchor" id="line-28"&gt; &lt;/span&gt;&lt;span class="anchor" id="line-29"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class="line874"&gt;As  long as you&amp;#8217;re using the standard PHP packages on your CentOS server  you won&amp;#8217;t need to do anything extra. If you&amp;#8217;re using extra PHP packages  that aren&amp;#8217;t part of the standard CentOS repositories (like php-mcrypt)  you&amp;#8217;ll have to remove them or find updated versions of them. &lt;span class="anchor" id="line-30"&gt; &lt;/span&gt;&lt;span class="anchor" id="line-31"&gt; &lt;/span&gt;&lt;span class="anchor" id="line-32"&gt; &lt;/span&gt;&lt;/p&gt;

&lt;h2 id="head-f3a28eaa2114e3ab40f86cc66f4ca8adb8a8813e"&gt;Add the development repositories&lt;/h2&gt;
&lt;p&gt;&lt;span class="anchor" id="line-33"&gt; &lt;/span&gt;&lt;span class="anchor" id="line-34"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class="line874"&gt;First  thing we need to do is add the development repositories to yum. When we  add the development repository we&amp;#8217;re going to configure it so it only  pulls PHP packages. To start we&amp;#8217;ll need create a new yum repository  configuration file (use your favorite editor): &lt;span class="anchor" id="line-35"&gt; &lt;/span&gt;&lt;span class="anchor" id="line-36"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;span class="anchor" id="line-37"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;pre&gt; # /etc/yum.repos.d/CentOS-Testing.repo
&lt;span class="anchor" id="line-38"&gt; &lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="anchor" id="line-39"&gt; &lt;/span&gt;&lt;span class="anchor" id="line-40"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class="line874"&gt;Copy/paste the following into this file: &lt;span class="anchor" id="line-41"&gt; &lt;/span&gt;&lt;span class="anchor" id="line-42"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;span class="anchor" id="line-43"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;  # CentOS-Testing:
&lt;span class="anchor" id="line-44"&gt; &lt;/span&gt;  # !!!! CAUTION !!!!
&lt;span class="anchor" id="line-45"&gt; &lt;/span&gt;  # This repository is a proving grounds for packages on their way to CentOSPlus and CentOS Extras.
&lt;span class="anchor" id="line-46"&gt; &lt;/span&gt;  # They may or may not replace core CentOS packages, and are not guaranteed to function properly.
&lt;span class="anchor" id="line-47"&gt; &lt;/span&gt;  # These packages build and install, but are waiting for feedback from testers as to
&lt;span class="anchor" id="line-48"&gt;&lt;/span&gt;  # functionality and stability. Packages in this repository will come and go during the
&lt;span class="anchor" id="line-49"&gt;&lt;/span&gt;  # development period, so it should not be left enabled or used on production systems without due
&lt;span class="anchor" id="line-50"&gt;&lt;/span&gt;  # consideration.
&lt;span class="anchor" id="line-51"&gt;&lt;/span&gt;  [c5-testing]
&lt;span class="anchor" id="line-52"&gt;&lt;/span&gt;  name=CentOS-5 Testing
&lt;span class="anchor" id="line-53"&gt;&lt;/span&gt;  baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/
&lt;span class="anchor" id="line-54"&gt;&lt;/span&gt;  enabled=1
&lt;span class="anchor" id="line-55"&gt;&lt;/span&gt;  gpgcheck=1
&lt;span class="anchor" id="line-56"&gt;&lt;/span&gt;  gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing
&lt;span class="anchor" id="line-57"&gt;&lt;/span&gt;  includepkgs=php*
&lt;span class="anchor" id="line-58"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="anchor" id="line-59"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-60"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line874"&gt;Make sure to remove any spaces at the start of each line, then save and close the file and you&amp;#8217;re done. &lt;span class="anchor" id="line-61"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-62"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-63"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2 id="head-7c4bda8f0b3ec3430b930030763e6275071f33c5"&gt;Update PHP packages&lt;/h2&gt;
&lt;p&gt;&lt;span class="anchor" id="line-64"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-65"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line874"&gt;Before  updating your PHP packages you&amp;#8217;ll want to get a list of what you  currently have installed. To get a list of current PHP packages run the  following: &lt;span class="anchor" id="line-66"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-67"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;span class="anchor" id="line-68"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt; # rpm -qa |grep php
&lt;span class="anchor" id="line-69"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="anchor" id="line-70"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-71"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line874"&gt;Now you can use yum to update the PHP packages on your system: &lt;span class="anchor" id="line-72"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-73"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;span class="anchor" id="line-74"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt; # yum update
&lt;span class="anchor" id="line-75"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="anchor" id="line-76"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-77"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line862"&gt;You  should be shown a list of packages that are going to be updated.  Compare it to the list of PHP packages on your system. Note any packages  that are not in the list. You&amp;#8217;ll need to remove these packages or find  updates for them because they won&amp;#8217;t work after you update to PHP 5.2.x.  If that is acceptable type &lt;strong&gt;&amp;#8220;y&amp;#8221;&lt;/strong&gt; to continue and let yum update the packages. &lt;span class="anchor" id="line-78"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-79"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line874"&gt;Once yum has completed restart Apache: &lt;span class="anchor" id="line-80"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-81"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;span class="anchor" id="line-82"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt; # service httpd restart
&lt;span class="anchor" id="line-83"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="anchor" id="line-84"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-85"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line862"&gt;To verify the update is working create a simple &lt;em&gt;testing.php&lt;/em&gt; in your www directory with the following source code: &lt;span class="anchor" id="line-86"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-87"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;span class="anchor" id="line-88"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&amp;lt;?php
&lt;span class="anchor" id="line-89"&gt;&lt;/span&gt;  phpinfo();
&lt;span class="anchor" id="line-90"&gt;&lt;/span&gt;?&amp;gt;
&lt;span class="anchor" id="line-91"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="anchor" id="line-92"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-93"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line874"&gt;and open it in a web browser. The new PHP version should be reflected at the top of the page. &lt;span class="anchor" id="line-94"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-95"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-96"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2 id="head-e4d1265336f4cd7f827ecab6e1dee674a1682616"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;&lt;span class="anchor" id="line-97"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-98"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line874"&gt;You should now have PHP 5.2.6 running on CentOS 5.3&amp;#160;32-bit. &lt;span class="anchor" id="line-99"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-100"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;span class="anchor" id="line-101"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span class="anchor" id="line-102"&gt;&lt;/span&gt; # rpm -qa |grep php
&lt;span class="anchor" id="line-103"&gt;&lt;/span&gt;
&lt;span class="anchor" id="line-104"&gt;&lt;/span&gt;  php-cli-5.2.6-2.el5s2
&lt;span class="anchor" id="line-105"&gt;&lt;/span&gt;  php-mbstring-5.2.6-2.el5s2
&lt;span class="anchor" id="line-106"&gt;&lt;/span&gt;  php-devel-5.2.6-2.el5s2
&lt;span class="anchor" id="line-107"&gt;&lt;/span&gt;  php-pdo-5.2.6-2.el5s2
&lt;span class="anchor" id="line-108"&gt;&lt;/span&gt;  php-gd-5.2.6-2.el5s2
&lt;span class="anchor" id="line-109"&gt;&lt;/span&gt;  php-dba-5.2.6-2.el5s2
&lt;span class="anchor" id="line-110"&gt;&lt;/span&gt;  php-common-5.2.6-2.el5s2
&lt;span class="anchor" id="line-111"&gt;&lt;/span&gt;  php-bcmath-5.2.6-2.el5s2
&lt;span class="anchor" id="line-112"&gt;&lt;/span&gt;  php-xml-5.2.6-2.el5s2
&lt;span class="anchor" id="line-113"&gt;&lt;/span&gt;  php-pear-1.5.1-2.el5s2
&lt;span class="anchor" id="line-114"&gt;&lt;/span&gt;  php-ldap-5.2.6-2.el5s2
&lt;span class="anchor" id="line-115"&gt;&lt;/span&gt;  php-5.2.6-2.el5s2
&lt;span class="anchor" id="line-116"&gt;&lt;/span&gt;  php-mysql-5.2.6-2.el5s2
&lt;span class="anchor" id="line-117"&gt;&lt;/span&gt;
&lt;span class="anchor" id="line-118"&gt;&lt;/span&gt;
&lt;span class="anchor" id="line-119"&gt;&lt;/span&gt; # php -v
&lt;span class="anchor" id="line-120"&gt;&lt;/span&gt;
&lt;span class="anchor" id="line-121"&gt;&lt;/span&gt;  PHP 5.2.6 (cli) (built: Sep 15 2008 20:42:05)
&lt;span class="anchor" id="line-122"&gt;&lt;/span&gt;  Copyright (c) 1997-2008 The PHP Group
&lt;span class="anchor" id="line-123"&gt;&lt;/span&gt;  Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
&lt;span class="anchor" id="line-124"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="anchor" id="line-125"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-126"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line862"&gt;Note: If your &lt;em&gt;&lt;strong&gt;&amp;#8220;php -v&amp;#8221;&lt;/strong&gt;&lt;/em&gt; output returns errors about &lt;em&gt;PDO&lt;/em&gt; or &lt;em&gt;JSON&lt;/em&gt; &lt;a href="http://wiki.centos.org/HowTos/PHP_5.1_To_5.2#PDO_JSON_Error"&gt;click here&lt;/a&gt; &lt;span class="anchor" id="line-127"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-128"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-129"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h2 id="head-ef0150910dfa751fe87d169da5db9567201baa21"&gt;Extras&lt;/h2&gt;
&lt;p&gt;&lt;span class="anchor" id="line-130"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-131"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h3 id="head-fe084db340a72a9b7b7fca8fcba57ef4e9a34485"&gt;Updating/Installing mcrypt&lt;/h3&gt;
&lt;p&gt;&lt;span class="anchor" id="line-132"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-133"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line874"&gt;If you have php-mcrypt for PHP 5.1.x installed you&amp;#8217;ll want to remove it: &lt;span class="anchor" id="line-134"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-135"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;strong&gt;Note:&lt;/strong&gt; Your version number maybe different. Alter below command accordingly. &lt;span class="anchor" id="line-136"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-137"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;span class="anchor" id="line-138"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt; rpm -e php-mcrypt-5.1.6-15.el5.centos.1
&lt;span class="anchor" id="line-139"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="anchor" id="line-140"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-141"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line862"&gt;Download php-mcrypt for PHP 5.2.x and install it. You can find a 32-bit php-mcrypt package here &lt;a href="http://redhatjunkies.com/index.php/PHP"&gt;FedoraJunkies&lt;/a&gt;. &lt;span class="anchor" id="line-142"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-143"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;strong&gt;Note:&lt;/strong&gt; You&amp;#8217;ll notice the &lt;strong&gt;&amp;#8220;&amp;#8212;nodeps&amp;#8221;&lt;/strong&gt; flag in the example. When you try to install php-mcrypt without it you get an error that &lt;em&gt;php-common-5.2.6-2.el5s2&lt;/em&gt; is missing even though it is installed. &lt;span class="anchor" id="line-144"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-145"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;span class="anchor" id="line-146"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt; wget -c &lt;a href="http://sourcemirrors.org/scotth/centos/5/php/php-mcrypt-5.2.6-2.i386.rpm"&gt;http://sourcemirrors.org/scotth/centos/5/php/php-mcrypt-5.2.6-2.i386.rpm&lt;/a&gt;
&lt;span class="anchor" id="line-147"&gt;&lt;/span&gt; rpm -i --nodeps php-mcrypt-5.2.6-2.i386.rpm
&lt;span class="anchor" id="line-148"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="anchor" id="line-149"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-150"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line862"&gt;Restart Apache and you should now see mcrypt information on your &lt;em&gt;testing.php&lt;/em&gt; page. &lt;span class="anchor" id="line-151"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-152"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-153"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h3 id="head-641f26b3f10bbc70e14b6092fc0ef5592d056b44"&gt;JSON and PDO being loaded twice&lt;/h3&gt;
&lt;p&gt;&lt;span class="anchor" id="line-154"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-155"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;span class="anchor" id="PDO_JSON_Error"&gt;&lt;/span&gt; &lt;span class="anchor" id="line-156"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-157"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line862"&gt;When you run the command &lt;strong&gt;&amp;#8220;php -v&amp;#8221;&lt;/strong&gt; you might see the following errors: &lt;span class="anchor" id="line-158"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-159"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;span class="anchor" id="line-160"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt; # php -v
&lt;span class="anchor" id="line-161"&gt;&lt;/span&gt;
&lt;span class="anchor" id="line-162"&gt;&lt;/span&gt;  PHP Warning:  Module 'json' already loaded in Unknown on line 0
&lt;span class="anchor" id="line-163"&gt;&lt;/span&gt;  PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
&lt;span class="anchor" id="line-164"&gt;&lt;/span&gt;  PHP 5.2.6 (cli) (built: Sep 15 2008 20:42:05)
&lt;span class="anchor" id="line-165"&gt;&lt;/span&gt;  Copyright (c) 1997-2008 The PHP Group
&lt;span class="anchor" id="line-166"&gt;&lt;/span&gt;  Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
&lt;span class="anchor" id="line-167"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="anchor" id="line-168"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-169"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line862"&gt;This is caused by the following two lines in the &lt;em&gt;/etc/php.ini&lt;/em&gt; file: &lt;span class="anchor" id="line-170"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-171"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;span class="anchor" id="line-172"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;; Extension JSON
&lt;span class="anchor" id="line-173"&gt;&lt;/span&gt;extension=json.so
&lt;span class="anchor" id="line-174"&gt;&lt;/span&gt;
&lt;span class="anchor" id="line-175"&gt;&lt;/span&gt;; Extension PDO
&lt;span class="anchor" id="line-176"&gt;&lt;/span&gt;extension=pdo.so
&lt;span class="anchor" id="line-177"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="anchor" id="line-178"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-179"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line862"&gt;Comment out these lines by adding a &lt;em&gt;&lt;strong&gt;&amp;#8221;;&amp;#8221;&lt;/strong&gt;&lt;/em&gt; in front of &lt;em&gt;&lt;strong&gt;&amp;#8220;extension=&amp;#8221;&lt;/strong&gt;&lt;/em&gt;. These two modules are already loaded via these two files: &lt;span class="anchor" id="line-180"&gt;&lt;/span&gt;&lt;span class="anchor" id="line-181"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="line867"&gt;&lt;span class="anchor" id="line-182"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;/etc/php.d/json.ini
&lt;span class="anchor" id="line-183"&gt;&lt;/span&gt;/etc/php.d/pdo.ini&lt;/pre&gt;</description><link>http://abhisheksingh.info/post/10976810189</link><guid>http://abhisheksingh.info/post/10976810189</guid><pubDate>Mon, 03 Oct 2011 07:11:12 -0400</pubDate></item><item><title>Install Apache on Centos Rackspace</title><description>&lt;p&gt;Source: &lt;a href="http://www.rackspace.com/knowledge_center/index.php/CentOS_-_Apache_and_PHP_install"&gt;http://www.rackspace.com/knowledge_center/index.php/CentOS_-_Apache_and_PHP_install&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;CentOS - Installing Apache and PHP5&lt;/h2&gt;
&lt;p&gt;CentOS comes with Apache v.2.2.3 and PHP v.5.1.6 and they are easily installed via the default CentOS Package Manager, yum.&lt;/p&gt;
&lt;p&gt;The advantage of using yum (as opposed to installing via source code)  is that you will get any security updates (if and when distributed) and  dependencies are automatically taken care of.&lt;/p&gt;
&lt;h2&gt;Apache Install&lt;/h2&gt;
&lt;p&gt;A basic Apache install is very easy:&lt;/p&gt;
&lt;pre&gt;sudo yum install httpd mod_ssl
&lt;/pre&gt;
&lt;p&gt;Oddly, the server does not start automatically when you install it so you have to do this by hand:&lt;/p&gt;
&lt;pre&gt;sudo /etc/init.d/httpd start
&lt;/pre&gt;
&lt;p&gt;The first thing you will see is this error:&lt;/p&gt;
&lt;pre&gt;Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name,
using 127.0.0.1 for ServerName
&lt;/pre&gt;
&lt;p&gt;As you can see, the address 127.0.0.1 is used as the server  name by default. It&amp;#8217;s a good idea to set the ServerName for the next  time the server is started.&lt;/p&gt;
&lt;p&gt;Open the main Apache “config”:&lt;/p&gt;
&lt;pre&gt;sudo nano /etc/httpd/conf/httpd.conf
&lt;/pre&gt;
&lt;p&gt;Towards the end of the file you&amp;#8217;ll find a section that starts with ServerName and gives the example:&lt;/p&gt;
&lt;pre&gt;#ServerName &lt;a href="http://www.example.com:80"&gt;www.example.com:80&lt;/a&gt;
&lt;/pre&gt;
&lt;p&gt;All you need to do is enter your Cloud Server host name or a fully-qualified domain name:&lt;/p&gt;
&lt;pre&gt;ServerName demo
&lt;/pre&gt;
&lt;p&gt;Note that my Cloud Server host name is “demo”.&lt;/p&gt;
&lt;p&gt;Now just reload Apache:&lt;/p&gt;
&lt;pre&gt;sudo /etc/init.d/httpd reload
&lt;/pre&gt;
&lt;p&gt;And the warning has gone.&lt;/p&gt;
&lt;h2&gt;Firewall&lt;/h2&gt;
&lt;p&gt;Notice that in some versions of CentOS, a firewall is installed by  default which will block access to port 80, on which Apache runs. The  following command will open this port:&lt;/p&gt;
&lt;pre&gt;sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT
&lt;/pre&gt;
&lt;p&gt;Remember to save your firewall rules after adding that  instruction so your web server will be accessible the next time you  reboot:&lt;/p&gt;
&lt;pre&gt;sudo service iptables save&lt;/pre&gt;
&lt;p&gt;For more information on firewalls and their configuration, it is strongly recommended to read the &lt;a title="/knowledge_center/index.php/List_of_Articles#Firewalls" href="http://www.rackspace.com/knowledge_center/index.php/List_of_Articles#Firewalls"&gt;Firewalls&lt;/a&gt; section of our knowledge base.&lt;/p&gt;
&lt;h2&gt;Default Page&lt;/h2&gt;
&lt;p&gt;If you navigate to your Cloud Server IP address:&lt;/p&gt;
&lt;pre&gt;&lt;a href="http://123.45.67.890"&gt;http://123.45.67.890&lt;/a&gt;
&lt;/pre&gt;
&lt;p&gt;You will see the default CentOS Apache welcome page.&lt;/p&gt;
&lt;p&gt;This means the Apache install is a success.&lt;/p&gt;
&lt;h2&gt;Chkconfig&lt;/h2&gt;
&lt;p&gt;Now that we have Apache installed and working properly, we need to  make sure that it&amp;#8217;s set to start automatically when the Cloud Server is  rebooted.&lt;/p&gt;
&lt;pre&gt;sudo /sbin/chkconfig httpd on
&lt;/pre&gt;
&lt;p&gt;Let&amp;#8217;s check our work to confirm:&lt;/p&gt;
&lt;pre&gt;sudo /sbin/chkconfig --list httpd
httpd           0:off        1:off  2:on    3:on    4:on    5:on    6:off
&lt;/pre&gt;
&lt;p&gt;The setting works.&lt;/p&gt;
&lt;h2&gt;PHP5 Install&lt;/h2&gt;
&lt;p&gt;Let&amp;#8217;s move on to the PHP5 install. I&amp;#8217;m not going to install all the  modules available, just a few common ones so you get the idea.&lt;/p&gt;
&lt;p&gt;As before, due to using yum to install PHP5, any dependencies are taken care of:&lt;/p&gt;
&lt;pre&gt;sudo yum install php php-common php-gd php-mcrypt php-pear php-pecl-memcache php-mhash php-mysql php-xml
&lt;/pre&gt;
&lt;p&gt;Once done, reload Apache:&lt;/p&gt;
&lt;pre&gt;sudo /etc/init.d/httpd reload
&lt;/pre&gt;</description><link>http://abhisheksingh.info/post/10976661947</link><guid>http://abhisheksingh.info/post/10976661947</guid><pubDate>Mon, 03 Oct 2011 07:00:00 -0400</pubDate></item><item><title>Configure jabber gtalk asterisk</title><description>&lt;p&gt;#apt-get instal libgnutls-dev&lt;/p&gt;
&lt;p&gt;Download, compile and install iksemel - xml parser and jabber protocol library&lt;/p&gt;
&lt;p&gt;&lt;a href="http://code.google.com/p/iksemel/downloads/list"&gt;http://code.google.com/p/iksemel/downloads/list&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Do not worry about the warning message, apparently iksemel does not compile with libgnutls2+ because of absence of gnutls-config but that is okay.&lt;/p&gt;
&lt;p&gt;Compile and install asterisk after ensuring that jabber, gtalk channels and resources are selected in menuselect.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Configuration&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;#cat jabber.conf&lt;/p&gt;
&lt;p&gt;[general]&lt;br/&gt;debug=yes&lt;br/&gt;autoprune=no&lt;br/&gt;autoregister=yes&lt;/p&gt;
&lt;p&gt;[asterisk]&lt;br/&gt;type=client&lt;br/&gt;serverhost=talk.google.com&lt;br/&gt;username=myname@gmail.com/Talk&lt;br/&gt;secret=password&lt;br/&gt;priority=1&lt;br/&gt;port=5222&lt;br/&gt;usetls=yes&lt;br/&gt;usesasl=yes&lt;br/&gt;buddy=username@gmail.com&lt;br/&gt;status=available&lt;br/&gt;statusmessage=&amp;#8221;I am a robot! Ha!&amp;#8221;&lt;br/&gt;timeout=100&lt;/p&gt;
&lt;p&gt;#cat gtalk.conf&lt;/p&gt;
&lt;p&gt;[general]&lt;br/&gt;context=default&lt;br/&gt;allowguest=yes&lt;br/&gt;&lt;br/&gt;[guest]&lt;br/&gt;disallow=all&lt;br/&gt;allow=ulaw&lt;br/&gt;context=guest&lt;/p&gt;
&lt;p&gt;#cat extensions.conf&lt;/p&gt;
&lt;p&gt;[gtalk-in]&lt;br/&gt;exten =&amp;gt; s,1,Answer()&lt;br/&gt;exten =&amp;gt; s,n,Wait(3)&lt;br/&gt;exten =&amp;gt; s,n,SendDTMF(1)&lt;br/&gt;exten =&amp;gt; s,n,Goto(demo,s,1)&lt;/p&gt;

&lt;p&gt;Also See&lt;/p&gt;
&lt;p&gt;&lt;a href="https://wiki.asterisk.org/wiki/display/AST/Calling+using+Google"&gt;https://wiki.asterisk.org/wiki/display/AST/Calling+using+Google&lt;/a&gt;&lt;/p&gt;</description><link>http://abhisheksingh.info/post/10901783153</link><guid>http://abhisheksingh.info/post/10901783153</guid><pubDate>Sat, 01 Oct 2011 16:11:00 -0400</pubDate></item><item><title>Start Process at Linux Boot</title><description>&lt;p&gt;How to start a new process at Linux Boot automatically&amp;#160;?&lt;/p&gt;
&lt;p&gt;All commands in /etc/rc.d/rc.local are executed AFTER the init scripts, so adding your shell process to this script is a quick method.&lt;/p&gt;
&lt;p&gt;The formal alternative is to put appropriate start/stop scripts in /etc/init.d and then make symbolic links in /etc/rc.d/init.d&lt;/p&gt;</description><link>http://abhisheksingh.info/post/10890101943</link><guid>http://abhisheksingh.info/post/10890101943</guid><pubDate>Sat, 01 Oct 2011 11:10:47 -0400</pubDate></item><item><title> Reverse SSH tunnel or connecting to computer behind NAT router</title><description>&lt;p&gt;Source: &lt;a href="http://www.alexonlinux.com/reverse-ssh-tunnel-or-connecting-to-computer-behind-nat-router"&gt;http://www.alexonlinux.com/reverse-ssh-tunnel-or-connecting-to-computer-behind-nat-router&lt;/a&gt;&lt;/p&gt;


&lt;h3&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Few days ago I encountered a problem. How do you connect to a  computer behind NAT router? Any NAT router is also a firewall. Sometimes  you do have access to firewall configuration and can set up port  forwarding. Yet often it is complicated and even impossible. Common  situation is when you want to connect to a computer in the office from  home. Companies usually hide office computers behind NAT routers and  firewalls. Hence you cannot connect to office computer as is.&lt;/p&gt;
&lt;p&gt;This is exactly the problem I had to overcome. After googling for  couple of minutes I found a solution called reverse SSH tunnel. Yet I  could not find a guide that explains how to make it work from A to Z. So  I decided to write one.&lt;/p&gt;
&lt;h3&gt;Understanding the setup&lt;/h3&gt;
&lt;p&gt;In our basic setup we have a &lt;em&gt;Home Computer&lt;/em&gt;. It runs Linux and can freely access the Internet. &lt;em&gt;Office Computer&lt;/em&gt; is the Linux machine behind &lt;em&gt;NAT router&lt;/em&gt;. We want to connect to &lt;em&gt;Office Computer &lt;/em&gt;but can’t because of the &lt;em&gt;NAT router&lt;/em&gt;. &lt;em&gt;Server&lt;/em&gt; is additional Linux machine. It has to be accessible from both home and office computers via SSH.&lt;/p&gt;
&lt;p&gt;&lt;img class="size-full wp-image-99" title="reverse_tunnel_diagram" src="http://www.alexandersandler.net/wp-content/uploads/2008/05/reverse_tunnel_diagram.jpg" height="230" width="500"/&gt;&lt;/p&gt;
&lt;h3&gt;Preparations&lt;/h3&gt;
&lt;p&gt;First, we have to make sure that SSH server on &lt;em&gt;Server&lt;/em&gt; has &lt;em&gt;GatewayPorts&lt;/em&gt; option turned on. You most likely have openssh SSH server. If so, open  /etc/ssh/sshd_config and make sure it has following line.&lt;/p&gt;
&lt;code&gt;1&lt;/code&gt;&lt;code class="plain"&gt;GatewayPorts yes&lt;/code&gt;
&lt;p&gt;If it’s missing, add it and restart SSH service.&lt;/p&gt;
&lt;p&gt;Now this is important. Using method described here you can connect to different ports on &lt;em&gt;Office Computer&lt;/em&gt;. However, if you want to connect to it via SSH you have to make sure that &lt;em&gt;GatewayPorts&lt;/em&gt; is on on the &lt;em&gt;Office Computer&lt;/em&gt; as well.&lt;/p&gt;
&lt;p&gt;Also, to connect you need access to the &lt;em&gt;Office Computer&lt;/em&gt;. I.e. you either have to ask someone to execute commands on &lt;em&gt;Office Computer&lt;/em&gt; for you, or you have to run them yourself in advance.&lt;/p&gt;
&lt;h3&gt;Connecting&lt;/h3&gt;
&lt;p&gt;This is the easy part.&lt;/p&gt;
&lt;p&gt;Assuming you want to connect to port X on &lt;em&gt;Office Computer&lt;/em&gt;, do the following.&lt;/p&gt;
&lt;p&gt;On &lt;em&gt;Office Computer&lt;/em&gt; do the following:&lt;/p&gt;
&lt;code&gt;1&lt;/code&gt;&lt;code class="plain"&gt;ssh -R 6333:localhost:X user_on_server@server&lt;/code&gt;
&lt;p&gt;&lt;em&gt;Server&lt;/em&gt; will require regular SSH credentials (either  certificate or password) and will open regular SSH session for you. This  is the tunnel session. Keep it open as long as you want to stay  connected to the &lt;em&gt;Office Computer&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;On &lt;em&gt;Home Computer&lt;/em&gt; connect to port 6333 on &lt;em&gt;Server&lt;/em&gt; as if it was port X on &lt;em&gt;Office Computer&lt;/em&gt;. In case you want to connect to SSH port on &lt;em&gt;Office Computer&lt;/em&gt;, set X to 22 (SSH port) in step 1 and do the following:&lt;/p&gt;
&lt;code&gt;1&lt;/code&gt;&lt;code class="plain"&gt;ssh user_on_office_computer@server -p 6333&lt;/code&gt;
&lt;p&gt;Again, you may be asked to identify yourself. Do it as you were connecting to &lt;em&gt;Office Computer &lt;/em&gt;directly.&lt;/p&gt;
&lt;h3&gt;Avoiding session expiration&lt;/h3&gt;
&lt;p&gt;As I mentioned in &lt;em&gt;Preparations&lt;/em&gt; section of this guide, you  can do step 1 in advance, before going home. Alternatively, you can ask  someone to do the command for you. In case you prefer to do it yourself,  you may want to make sure that tunnel connection you established won’t  expire.&lt;/p&gt;
&lt;p&gt;There are three options in /etc/ssh/sshd_config that control SSH  session expiration. Once in a while SSH server sends keep-alive messages  to connected clients. Temporary connectivity problem can cause it to  disconnect certain SSH session, despite this is only a very temporary  problem. Depending on the configuration of you SSH server, you may want  to prevent these keep-alive messages. On the contrary you may want to  increase interval between them or change number of lost keep-alive  messages that indicate to SSH server that a connection to a client has  been lost.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;TCPKeepAlive&lt;/em&gt; configuration option enables or disables  keep-alive messages. The default is yes (i.e. send keep-alives) and it  is a good practice to keep it this way.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;ClientAliveInterval&lt;/em&gt; specifies number of seconds between every keep-alive message. Depending on quality of connection between &lt;em&gt;Office Computer &lt;/em&gt;and the &lt;em&gt;Server&lt;/em&gt; we may want to set it to, let’s say 10.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;ClientAliveCountMax&lt;/em&gt; controls number of lost keep-alive  messages that cause SSH server to pull the plug. We want it relatively  big, but not too big. With &lt;em&gt;ClientAliveInterval&lt;/em&gt; equals 10, its a  good idea to loose the connection after keep-alive messages fail for  lets say 5 minutes – 300 seconds. This means we can make &lt;em&gt;ClientAliveCountMax&lt;/em&gt; equals 30.&lt;/p&gt;</description><link>http://abhisheksingh.info/post/10888732774</link><guid>http://abhisheksingh.info/post/10888732774</guid><pubDate>Sat, 01 Oct 2011 10:28:57 -0400</pubDate></item><item><title>SSH without password</title><description>&lt;p&gt;Source: &lt;a href="http://linuxproblem.org/art_9.html"&gt;http://linuxproblem.org/art_9.html&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Your aim&lt;/h2&gt;
&lt;p&gt;You want to use Linux and OpenSSH to automize your tasks. Therefore you need an &lt;strong&gt;automatic&lt;/strong&gt; login from host A / user a to Host B / user b. You don&amp;#8217;t want to enter any passwords, because you want to call ssh from a within a shell script.&lt;/p&gt;
&lt;h2&gt;How to do it&lt;/h2&gt;
&lt;p&gt;First log in on A as user a and generate a pair of authentication keys.  Do not enter a passphrase:&lt;/p&gt;
&lt;pre class="shell"&gt;a@A:~&amp;gt; ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa): 
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A
&lt;/pre&gt;
&lt;p&gt;Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine):&lt;/p&gt;
&lt;pre class="shell"&gt;a@A:~&amp;gt; ssh b@B mkdir -p .ssh
b@B's password: 
&lt;/pre&gt;
&lt;p&gt;Finally append a&amp;#8217;s new public key to b@B:.ssh/authorized_keys and enter b&amp;#8217;s password one last time:&lt;/p&gt;
&lt;pre class="shell"&gt;a@A:~&amp;gt; cat .ssh/id_rsa.pub | ssh b@B 'cat &amp;gt;&amp;gt; .ssh/authorized_keys'
b@B's password: 
&lt;/pre&gt;
&lt;p&gt;From now on you can log into B as b from A as a without password:&lt;/p&gt;
&lt;pre class="shell"&gt;a@A:~&amp;gt; ssh b@B hostname
B
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;A note&lt;/strong&gt; from one of our readers:  Depending on your version of SSH you might also have to do the following changes:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Put the public key in .ssh/authorized_keys2&lt;/li&gt;
&lt;li&gt;Change the permissions of .ssh to 700&lt;/li&gt;
&lt;li&gt;Change the permissions of .ssh/authorized_keys2 to 640&lt;/li&gt;
&lt;/ul&gt;</description><link>http://abhisheksingh.info/post/10888674451</link><guid>http://abhisheksingh.info/post/10888674451</guid><pubDate>Sat, 01 Oct 2011 10:27:05 -0400</pubDate></item><item><title>Install Asterisk CentOS</title><description>&lt;p&gt;#yum install gcc-c++ make gnutls-devel kernel-devel kernel ncurses-devel&lt;/p&gt;
&lt;p&gt;#reboot; if new kernel is installed&lt;/p&gt;
&lt;p&gt;# cd /usr/src&lt;/p&gt;
&lt;p&gt;#wget &lt;a href="http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.8.7.0.tar.gz"&gt;http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.8.7.0.tar.gz&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;#tar xvzf asterisk-1.8.7.0.tar.gz&lt;/p&gt;
&lt;p&gt;#cd asterisk-1.8.7.0&lt;/p&gt;
&lt;p&gt;#./configure &amp;#8212;disable-xmldoc&lt;/p&gt;
&lt;p&gt;#make menuselect&lt;/p&gt;
&lt;p&gt;select cdr mysql in addons if needed&lt;/p&gt;
&lt;p&gt;#make all&lt;/p&gt;
&lt;p&gt;#make install&lt;/p&gt;
&lt;p&gt;#make sample&lt;/p&gt;
&lt;p&gt;#make config&lt;/p&gt;</description><link>http://abhisheksingh.info/post/10885873351</link><guid>http://abhisheksingh.info/post/10885873351</guid><pubDate>Sat, 01 Oct 2011 08:34:09 -0400</pubDate></item><item><title>PHP cURL Tutorial</title><description>&lt;p&gt;Source: &lt;a href="http://www.catswhocode.com/blog/10-awesome-things-to-do-with-curl"&gt;http://www.catswhocode.com/blog/10-awesome-things-to-do-with-curl&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://morethanseven.net/2007/01/20/posting-to-twitter-using-php.html"&gt;http://morethanseven.net/2007/01/20/posting-to-twitter-using-php.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;cURL, and its PHP extension libcURL, are tools which can be  used to simulate a web browser. In fact, it can for example, submit  forms. In this article, I’m going to show you 10 incredible things that  you can do using PHP and cURL.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;New to cURL?&lt;/strong&gt; If yes, check out the following articles to learn the purposes and basics of cURL/libcurl.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a target="blank" href="http://en.wikipedia.org/wiki/CURL"&gt;cURL Wikipedia page&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="blank" href="http://curl.haxx.se/docs/httpscripting.html"&gt;cURL tutorial: Using cURL to automate HTTP jobs &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Please  note that some of the techniques shown here can be used for “blackhat”  methods. The goal of this article is only educationnal, please do not  use any of the snippets below for illegal stuff.&lt;/p&gt;
&lt;h2&gt;1 – Update your Facebook status&lt;/h2&gt;
&lt;p&gt;Wanna  update your facebook status, but don’t want to go to facebook.com,  login, and finally being able to update your status? Simply save the  following code on your server, define the variables, and voilÃ&amp;#160;!&lt;/p&gt;
&lt;pre&gt;&amp;lt;?PHP
/*******************************
*	Facebook Status Updater
*	Christian Flickinger
*	&lt;a href="http://nexdot.net/blog"&gt;http://nexdot.net/blog&lt;/a&gt;
*	April 20, 2007
*******************************/

$status = 'YOUR_STATUS';
$first_name = 'YOUR_FIRST_NAME';
$login_email = 'YOUR_LOGIN_EMAIL';
$login_pass = 'YOUR_PASSWORD';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://login.facebook.com/login.php?m&amp;amp;amp;next=http%3A%2F%2Fm.facebook.com%2Fhome.php');
curl_setopt($ch, CURLOPT_POSTFIELDS,'email='.urlencode($login_email).'&amp;amp;pass='.urlencode($login_pass).'&amp;amp;login=Login');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_COOKIEJAR, "my_cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEFILE, "my_cookies.txt");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
curl_exec($ch);

curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_URL, 'http://m.facebook.com/home.php');
$page = curl_exec($ch);

curl_setopt($ch, CURLOPT_POST, 1);
preg_match('/name="post_form_id" value="(.*)" \/&amp;gt;'.ucfirst($first_name).'/', $page, $form_id);
curl_setopt($ch, CURLOPT_POSTFIELDS,'post_form_id='.$form_id[1].'&amp;amp;status='.urlencode($status).'&amp;amp;update=Update');
curl_setopt($ch, CURLOPT_URL, 'http://m.facebook.com/home.php');
curl_exec($ch);
?&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="http://codesnippets.joyent.com/posts/show/1204"&gt;&lt;a href="http://codesnippets.joyent.com/posts/show/1204"&gt;http://codesnippets.joyent.com/posts/show/1204&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;2 – Get download speed of your webserver&lt;/h2&gt;
&lt;p&gt;Do  you ever wanted to know the exact download speed of your webserver (or  any other?) If yes, you’ll love that code. You just have to initialize  the $url variable with any resources from the webserver (images, pdf,  etc), place the file on your server and point your browser to it. The  output will be a full report of download speed.&lt;/p&gt;
&lt;pre&gt;&amp;lt;?php error_reporting(E_ALL | E_STRICT);

// Initialize cURL with given url
$url = 'http://download.bethere.co.uk/images/61859740_3c0c5dbc30_o.jpg';
$ch = curl_init($url);

curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, 'Sitepoint Examples (thread 581410; &lt;a href="http://www.sitepoint.com/forums/showthread.php?t=581410"&gt;http://www.sitepoint.com/forums/showthread.php?t=581410&lt;/a&gt;)');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);

set_time_limit(65);

$execute = curl_exec($ch);
$info = curl_getinfo($ch);

// Time spent downloading, I think
$time = $info['total_time']
      - $info['namelookup_time']
      - $info['connect_time']
      - $info['pretransfer_time']
      - $info['starttransfer_time']
      - $info['redirect_time'];

// Echo friendly messages
header('Content-Type: text/plain');
printf("Downloaded %d bytes in %0.4f seconds.\n", $info['size_download'], $time);
printf("Which is %0.4f mbps\n", $info['size_download'] * 8 / $time / 1024 / 1024);
printf("CURL said %0.4f mbps\n", $info['speed_download'] * 8 / 1024 / 1024);

echo "\n\ncurl_getinfo() said:\n", str_repeat('-', 31 + strlen($url)), "\n";
foreach ($info as $label =&amp;gt; $value)
{
	printf("%-30s %s\n", $label, $value);
}
?&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="http://cowburn.info/2008/11/29/download-speed-php-curl"&gt;&lt;a href="http://cowburn.info/2008/11/29/download-speed-php-curl"&gt;http://cowburn.info/2008/11/29/download-speed-php-curl&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;3 – Myspace login using cURL&lt;/h2&gt;
&lt;pre&gt;&amp;lt;?php

function login( $data, $useragent = 'Mozilla 4.01', $proxy = false ) {
    $ch = curl_init();
    $hash = crc32( $data['email'].$data['pass'] );
    $hash = sprintf( "%u", $hash );
    $randnum = $hash.rand( 0, 9999999 );
    if( $proxy ) curl_setopt( $ch, CURLOPT_PROXY, $proxy );
    curl_setopt( $ch, CURLOPT_COOKIEJAR, '/tmp/cookiejar-'.$randnum );
    curl_setopt( $ch, CURLOPT_COOKIEFILE, '/tmp/cookiejar-'.$randnum );
    curl_setopt( $ch, CURLOPT_USERAGENT, $useragent );
    curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
    curl_setopt( $ch, CURLOPT_POST, 0);
    curl_setopt( $ch, CURLOPT_URL, 'http://www.myspace.com' );
    $page = curl_exec( $ch );
    preg_match( '/MyToken=(.+?)"/i', $page, $token );
    if( $token[1] ) {
        curl_setopt( $ch, CURLOPT_URL, 'http://login.myspace.com/index.cfm?fuseaction=login.process&amp;amp;MyToken='.$token[1] );
        curl_setopt( $ch, CURLOPT_REFERER, 'http://www.myspace.com' );
        curl_setopt( $ch, CURLOPT_HTTPHEADER, Array( 'Content-Type: application/x-www-form-urlencoded' ) );
        curl_setopt( $ch, CURLOPT_POST, 1 );
        $postfields = 'NextPage=&amp;amp;email='.urlencode( $data['mail'] ).'&amp;amp;password='.urlencode( $data['pass'] ).'&amp;amp;loginbutton.x=&amp;amp;loginbutton.y=';
        curl_setopt( $ch, CURLOPT_POSTFIELDS, $postfields );
        $page = curl_exec( $ch );
        if( strpos( $page, 'SignOut' ) !== false ) {
                return $randnum;
        }
        else {
            preg_match( '/MyToken=(.+?)"/i', $page, $token );
            preg_match( '/replace\("([^\"]+)"/', $page, $redirpage );
            if( $token[1] ) {
                curl_setopt( $ch, CURLOPT_POST, 0 );
                curl_setopt( $ch, CURLOPT_URL, 'http://home.myspace.com/index.cfm?&amp;amp;fuseaction=user&amp;amp;Mytoken='.$token[1] );
                $page = curl_exec( $ch );
                curl_close( $ch );
                if( strpos( $page, 'SignOut' ) !== false ) {
                    return $randnum;
                }
            }
            elseif( $redirpage[1] ) {
                curl_setopt( $ch, CURLOPT_REFERER, 'http://login.myspace.com/index.cfm?fuseaction=login.process&amp;amp;MyToken='.$token[1] );
                curl_setopt( $ch, CURLOPT_URL, $redirpage[1] );
                curl_setopt( $ch, CURLOPT_POST, 0 );
                $page = curl_exec( $ch );
                curl_close( $ch );
                if( strpos( $page, 'SignOut' ) !== false ) {
                    return $randnum;
                }
            }
        }
    }
    return false;
}
?&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="http://www.seo-blackhat.com/article/myspace-login-function-php-curl.html"&gt;&lt;a href="http://www.seo-blackhat.com/article/myspace-login-function-php-curl.html"&gt;http://www.seo-blackhat.com/article/myspace-login-function-php-curl.html&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;4 – Publish a post on your WordPress blog, using cURL&lt;/h2&gt;
&lt;p&gt;I know that most of you enjoy WordPress, so here is a nice “hack” as the ones I regulary publish on my other blog &lt;a href="http://www.wprecipes.com/"&gt;WpRecipes&lt;/a&gt;.&lt;br/&gt; This function can post on your WordPress blog. You don’t need to login to your WP dashboard etc.&lt;br/&gt; Though, you must activate the XMLRPC posting option in your WordPress  blog. If this option isn’t activated, the code will not be able to  insert anything into WordPress database. Another thing, make sure the  XMLRPC functions are activated on your php.ini file.&lt;/p&gt;
&lt;pre&gt;function wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$category,$keywords='',$encoding='UTF-8')
{
    $title = htmlentities($title,ENT_NOQUOTES,$encoding);
    $keywords = htmlentities($keywords,ENT_NOQUOTES,$encoding);

    $content = array(
        'title'=&amp;gt;$title,
        'description'=&amp;gt;$body,
        'mt_allow_comments'=&amp;gt;0,  // 1 to allow comments
        'mt_allow_pings'=&amp;gt;0,  // 1 to allow trackbacks
        'post_type'=&amp;gt;'post',
        'mt_keywords'=&amp;gt;$keywords,
        'categories'=&amp;gt;array($category)
    );
    $params = array(0,$username,$password,$content,true);
    $request = xmlrpc_encode_request('metaWeblog.newPost',$params);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
    curl_setopt($ch, CURLOPT_URL, $rpcurl);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 1);
    $results = curl_exec($ch);
    curl_close($ch);
    return $results;
?&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="http://porn-sex-viagra-casino-spam.com/coding/poster-automatiquement-sur-wordpress-avec-php/"&gt;&lt;a href="http://porn-sex-viagra-casino-spam.com/coding/poster-automatiquement-sur-wordpress-avec-php/"&gt;http://porn-sex-viagra-casino-spam.com/coding/poster-automatiquement-sur-wordpress-avec-php/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;5 – Test the existence of a given url&lt;/h2&gt;
&lt;p&gt;I know, it sounds basic. In fact, &lt;em&gt;it is basic&lt;/em&gt;, but it is also very useful, especially when you have to work with external resources.&lt;/p&gt;
&lt;pre&gt;&amp;lt;?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.jellyandcustard.com/");
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch)
echo $data;
?&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="http://www.phpsnippets.info/test-existence-of-a-given-url-with-curl"&gt;&lt;a href="http://www.phpsnippets.info/test-existence-of-a-given-url-with-curl"&gt;http://www.phpsnippets.info/test-existence-of-a-given-url-with-curl&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;6 – Post comments on WordPress blogs&lt;/h2&gt;
&lt;p&gt;In a previous article, &lt;a href="http://www.catswhocode.com/blog/how-spammers-spams-your-blog-comments"&gt;I have discussed how spammers spams your WordPress blog&lt;/a&gt;. To do so, they simply have to fill the $postfields array with the info they want to display and load the page.&lt;br/&gt; Of course, this code is only for educationnal purposes.&lt;/p&gt;
&lt;pre&gt;&amp;lt;?php
$postfields = array();
$postfields["action"] = "submit";
$postfields["author"] = "Spammer";
$postfields["email"] = "spammer@spam.com";
$postfields["url"] = "http://www.iamaspammer.com/";
$postfields["comment"] = "I am a stupid spammer.";
$postfields["comment_post_ID"] = "123";
$postfields["_wp_unfiltered_html_comment"] = "0d870b294b";
//Url of the form submission
$url = "http://www.ablogthatdoesntexist.com/blog/suggerer_site.php?action=meta_pass&amp;amp;id_cat=0";
$useragent = "Mozilla/5.0";
$referer = $url; 

//Initialize CURL session
$ch = curl_init($url);
//CURL options
curl_setopt($ch, CURLOPT_POST, 1);
//We post $postfields data
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
//We define an useragent (Mozilla/5.0)
curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
//We define a refferer ($url)
curl_setopt($ch, CURLOPT_REFERER, $referer);
//We get the result page in a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//We exits CURL
$result = curl_exec($ch);
curl_close($ch);

//Finally, we display the result
echo $result;
?&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="http://www.catswhocode.com/blog/how-spammers-spams-your-blog-comments"&gt;&lt;a href="http://www.catswhocode.com/blog/how-spammers-spams-your-blog-comments"&gt;http://www.catswhocode.com/blog/how-spammers-spams-your-blog-comments&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;7 – Follow your Adsense earnings with an RSS reader&lt;/h2&gt;
&lt;p&gt;Most  bloggers uses Adsense on their blog and (try to) make money with  Google. This excellent snippet allows you to follow your Adsense  earnings…with a RSS reader! Definitely awesome.&lt;br/&gt;&lt;em&gt;(Script too big to be displayed on the blog, click &lt;a href="http://planetozh.com/download/rss-adsense.txt"&gt;here to preview&lt;/a&gt;)&lt;/em&gt;&lt;br/&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="http://planetozh.com/blog/my-projects/track-adsense-earnings-in-rss-feed/"&gt;&lt;a href="http://planetozh.com/blog/my-projects/track-adsense-earnings-in-rss-feed/"&gt;http://planetozh.com/blog/my-projects/track-adsense-earnings-in-rss-feed/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;8 – Get feed subscribers count in full text&lt;/h2&gt;
&lt;p&gt;If  you’re a blogger, you’re probably using the popular FeedBurner service,  which allo you to know how many people grabbed your rss feed.  Feedburner have a chicklet to proudly display your subscriber count on  your blog. I personally like the chicklet’s look, but I heard lots of  bloggers complaining about it. happilly, cURL can simply grab the count  value and return it to you as a variable so you can display it as you  want on your blog.&lt;/p&gt;
&lt;pre&gt;//get cool feedburner count
$whaturl="https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=feedburner-id";

//Initialize the Curl session
$ch = curl_init();

//Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

//Set the URL
curl_setopt($ch, CURLOPT_URL, $whaturl);

//Execute the fetch
$data = curl_exec($ch);

//Close the connection
curl_close($ch);
$xml = new SimpleXMLElement($data);
$fb = $xml-&amp;gt;feed-&amp;gt;entry['circulation'];
//end get cool feedburner count
&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="http://www.hongkiat.com/blog/display-google-feed-subscriber-count-in-text/"&gt;&lt;a href="http://www.hongkiat.com/blog/display-google-feed-subscriber-count-in-text/"&gt;http://www.hongkiat.com/blog/display-google-feed-subscriber-count-in-text/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;9 – Get the content of a webpage into a PHP variable&lt;/h2&gt;
&lt;p&gt;This  is a very basic thing to do with cURL, but with endless possibilities.  Once you have a webpage in a PHP variable, you can for example, retrieve  a particular information on the page to use on your own website.&lt;/p&gt;
&lt;pre&gt;&amp;lt;?php
    ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "example.com");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $output = curl_exec($ch);
    curl_close($ch);
?&amp;gt;
&lt;/pre&gt;
&lt;h2&gt;10 – Post to Twitter using PHP and cURL&lt;/h2&gt;
&lt;p&gt;Twitter is very popular since some time now, and you probably already have an account there. (&lt;a href="http://www.twitter.com/catswhocode"&gt;We have one too&lt;/a&gt;) So, what about using cURL to tweet from your server without connectiong to Twitter?&lt;/p&gt;
&lt;pre&gt;&amp;lt;?php
// Set username and password
$username = 'username';
$password = 'password';
// The message you want to send
$message = 'is twittering from php using curl';
// The twitter API address
$url = 'http://twitter.com/statuses/update.xml';
// Alternative JSON version
// $url = 'http://twitter.com/statuses/update.json';
// Set up and execute the curl process
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "$url");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$message");
curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
// check for success or failure
if (empty($buffer)) {
    echo 'message';
} else {
    echo 'success';
}
?&amp;gt;
&lt;/pre&gt;</description><link>http://abhisheksingh.info/post/10883284998</link><guid>http://abhisheksingh.info/post/10883284998</guid><pubDate>Sat, 01 Oct 2011 05:45:00 -0400</pubDate></item></channel></rss>

