Install AWStats with GeoIP Plugin

Hits: 7733  

AWStats is a free analytic tool that generates web, streaming, ftp or mail server statistics, graphically. There are many log analyzer but AWStats is open source Web analytics reporting tool, It can analyze log files from Apache, WebStar, IIS.

Installing AWStats on ubuntu 12.04

# apt-get install awstats

Configuring for replace with your real domain

# cp /etc/awstats/awstats.conf /etc/awstats/
# vi /etc/awstats/

Check you have below settings in /etc/awstats/


Generate stats for AWStats for /var/log/apache2/access.log file (Make sure you have fresh log file)

# /usr/lib/cgi-bin/ -update

configuration Apache2 with password

# htpasswd -c /etc/awstats/awstats.pwd admin
# chmod 755 /etc/awstats/awstats.pwd

# vi /etc/apache2/sites-available/awstats

<VirtualHost *:80>
DocumentRoot /var/www
ErrorLog ${APACHE_LOG_DIR}/error_awstats.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access_awstats.log combined
<Directory “/usr/lib/cgi-bin/”>
<Files “”>
Options +ExecCGI
Alias /awstats-icon/ “/usr/share/awstats/icon/”
<Directory /usr/share/awstats/icon>
Options None
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine on
RewriteRule /awstats-icon – [L]
RewriteCond %{QUERY_STRING} !^(.*&)?framename=index(&.*)?$
RewriteCond %{QUERY_STRING} ^(.*&)?framename=.*(&.*)?$
RewriteRule /(.*) /usr/lib/cgi-bin/ [L]
RewriteCond %{QUERY_STRING} ^(.*&)?config=([^&]*)(&(.*))?$
RewriteRule /.* /%2?%1%4 [R,L]
RewriteRule /$ / [R,L]
RewriteRule /([^/]*)(/.*)? /usr/lib/cgi-bin/$1 [QSA,L]
<Location />
SetHandler cgi-script
Satisfy any
Order deny,allow
Deny from all
AuthType Basic
AuthName “AWStats Access”
AuthUserFile /etc/awstats/awstats.pwd
require valid-user
<LocationMatch /(?!|robots.txt)$>
Require user admin
<Location /awstats-icon>
SetHandler None
Allow from all

Enable Virtual Host

# a2ensite awstats
# apache2ctl configtest
# /etc/init.d/apache2 reload

Auto update stats

# crontab -e

*/10 * * * * /usr/share/awstats/tools/
10 03 * * * /usr/share/awstats/tools/
*/10 * * * * /usr/lib/cgi-bin/ -update > /dev/null

Set proper permission on logs

# sudo chmod 644 -R /var/log/apache2/*
# chmod 644 /var/log/apache2

# vi /etc/logrotate.d/apache2   (Replace create 640 root adm with create 644 root adm)

Install GeoIP for AWStats

# apt-get install build-essential zlib1g-dev apg libgeo-ipfree-perl libnet-ip-perl libnet-dns-perl liburi-perl apache2-utils

# cd /usr/src/
# wget
# tar xvzf zlib-1.2.8.tar.gz
# cd zlib-1.2.8
# ./configure –prefix=/usr/local/zlib && make && make install

# wget
# tar xzvf GeoIP-latest.tar.gz
# cd GeoIP-1.6.0
# ./configure && make && make install

# cpan
> install YAML
> install Geo::IP Geo::IPfree Geo::IP::PurePerl URI::Escape Net::IP Net::DNS Net::XWhois Time::HiRes Time::Local
> quit

# cd /usr/src/
# wget
# gzip -d GeoLiteCity.dat.gz
# cp GeoLiteCity.dat /usr/share/GeoIP/GeoLiteCity.dat

Enable AWSTAT configuation for LoadPlugin

# vi /etc/awstats/

Remove comment from /etc/awstats/

LoadPlugin=”geoip GEOIP_STANDARD /usr/share/GeoIP/GeoIP.dat”
LoadPlugin=”geoip_city_maxmind GEOIP_STANDARD /usr/share/GeoIP/GeoLiteCity.dat”

# /etc/init.d/apache2 reload

AWStats will run here




Error opening /usr/share/GeoIP/GeoIPCity.dat at /usr/local/share/perl/5.14.2/Geo/IP/ line [file name in /usr/share/GeoIP]

Make sure you have all files in folder /usr/share/GeoIP/GeoLiteCity.dat else copy

# cp /usr/share/GeoIP/GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat


Other log file analysis and reporting tools

Radio Song Album Artwork Cover by YouTube

Hits: 3918  

An album cover is the front / other side of the packaging of a commercially released audio recording product, or album.

You can find online APIs or Websites where artwork available

– Amazon
– LastFM
– Soundcloud
– Apple iTune
– Google Play
– Gracenote
– Free Music Archive

And many more ….

But YouTube is the best source where you can get Album / Song Cover Image for every Title

YouTube provide gdata API to search songs as video title to get image

Deprecated Features for YouTube API v2.0

YouTube Data API (v3)<search term>


$q = isset($_REQUEST['q'])?$_REQUEST['q']:"";

//thumbnail -> sqDefault, hqDefault

// orderby -> title, relevance, published

<div id="videos"></div>
<!-- Include the latest jQuery library -->
<script src=""></script>
<script type="text/javascript">

jQuery.getJSON('<?php echo $q; ?>&max-results=1&v=2&alt=jsonc&orderby=relevance', function(data) {
    var output="<ul>";
    for (var i in {
		output+="<li><img src='" +[i].thumbnail.hqDefault + "' /></li>";
		output+="<li>" +[i].title + "</li>";
	var output="</ul>";


How you can get cover image?

song album artwork

Install Centova Cast

Hits: 4417  

Centova Cast is an internet radio stream hosting control panel. It is used for hosting radio streams and manage Radio Server like ShoutCast and IceCast. You can manage Auto DJ using Centova Cast v2 Auto DJ System plus Server Control Panel.

Centova Cast Admin

System Requirements for Centova Cast: You can install it on any Linux-based servers.

Operating system: CentOS 4/5/6, RHEL, Debian Linux
Database server: MySQL v4.1+, v5.0, v5.1, or v5.5
Streaming server: SHOUTcast v2.0, SHOUTcast v1.9, IceCast v2.x
Streaming source: ices-cc, sc_trans v2.0, ices v2, ices v0.4, ezstream 0.5.3, sc_trans 0.4.0

# apt-get install liblwp-useragent-determined-perl libconfig-tiny-perl libnet-snmp-perl libxml-simple-perl libconfig-simple-perl libmp3lame-dev libxml2-dev

# apt-get install libxml2 libvorbis-dev libogg-dev libxslt1-dev libcurl3-gnutls libogg0 libspeex1 libtheora0 libvorbis0a libxslt1.1

# wget -O
# chmod a+x ./

# ./ –shoutcast-all
# /usr/local/centovacast/sbin/update –add shoutcast1
# apt-get install ia32-libs

# ./ –icecast-all

PayPal auto redirect credit card user to website after payment

Hits: 4302  

I have a problem on my Pay Per Video Website (PPV), Guests normally watch preview of videos for few seconds then PayPal Screen appear to watch full version of video content.


Pay Per Plugin for HTML5 Media – Pay Per Plugin for HTML5 Media Plugin is embedded stand-alone, e-commerce-powered JavaScript and iFramed widget for Audio/Video. – See more at:

I am using paypal form …

<form action=”<?php echo $paypal_link; ?>” target=”_top” method=”post” name=”payPalForm”>
<input type=”hidden” name=”business” value=”<?php echo $business_email;?>”>
<input type=”hidden” name=”cmd” value=”_xclick”>
<input type=”hidden” name=”item_name” value=”<?php echo $item_name; ?>”>
<input type=”hidden” name=”item_number” value=”<?php echo $item_number; ?>”>
<input type=”hidden” name=”amount” value=”<?php echo sprintf(“%01.2f”, $amount); ?>”>
<input type=”hidden” name=”no_shipping” value=”1″>
<input type=”hidden” name=”currency_code” value=”<?php echo $currency_code; ?>”>
<input type=”hidden” name=”handling” value=”0″>
<input type=”hidden” name=”rm” value=”2″ >
<input type=”hidden” name=”cancel_return” value=”<?php echo $siteurl; ?>cancel.php”>
<input type=”hidden” name=”return” value=”<?php echo $siteurl; ?>success.php”>
<input type=”image” src=”” border=”0″ name=”submit” alt=”PayPal – The safer, easier way to pay online!”>
<img alt=”” border=”0″ src=”” width=”1″ height=”1″>


I have enabled auto return ON and auto return URL in paypal settings already ….

Auto Return URL

When customers pay using paypal they easily redirected to PPV website … but if someone (guest) pay from credit card .. they have to click on link to redirect back to website …. 🙁

PayPal Auto Redirect to Website


You can find more info here Merchant Services from PayPal – Payment Solutions for Your Business

PayPal Standard Payments is designed in such a way if a customer pays as guest (they don’t have a PayPal Account), after they complete the checkout process, PayPal will offer to open PayPal Account or click on the link to return them to PPV website. Customers “must” click on the link in order to return to your web site.

You can use either PayPal Payments Pro or Advanced, if you want the customer to remain on your web site for the checkout process. Advanced PayPal method enable customer to remains on PPV website. The PayPal process work thru a window or frame on your website.

Merchant Services from PayPal - Payment Solutions for Your Business

PayPal Pro and Advanced are available in additional monthly costs as well as the transaction processing fees.
Pro is $30 a month, Advanced is $5 a month. 🙂

Red5 CMS

Hits: 3566  

Hope you already read our article for Media Streaming CMS.

Using Red5 CMS you can manage your Red5, Wowza, RTMP streams and publish using open source player. You can track your media content and embed on other websites.

Red5 Admin Login

Red5 CMS Home

Red5 CMS Categories

Red5 CMS Add Categories

Red5 Server Infomation

Red5 Streams

Red5 CMS Edit Streams

Red5 CMS Stream Offline

MP3 waveforms with PHP

Hits: 7203  

If you are thinking how generates the waveform for sound MP3 player?


There are some audio processing libraries used to process MP3 files to WAV and then PNG / SVG images..

MP3 to WAV to PNG

1. LAME MP3 encoder/decoder

$ lame input.mp3 -f -m m -b 16 –resample 8 resampled.mp3 && lame –decode resampled.mp3 output.wav

2. SOX – Sound eXchange

$ sox output.wav −n spectrogram
$ sox output.wav -n spectrogram -Y 140 -l -r -o output.png

3. wav2png – Creates waveform pngs out of audio files

$ sox mp3-song.mp3 -c 1 -t wav – | wav2png -o mp3-song.png /dev/stdin
$ wav2png –foreground-color=2e4562ff –background-color=00000000 -o  output.png   input.wav

4. wavesurfer.js is a customizable audio waveform visualization, built on top of Web Audio API and HTML5 Canvas


<script src=""></script>
<script src=""></script>
<script src=""></script>

<div id="waveform"></div>


var wavesurfer = WaveSurfer.create({
container: '#waveform',
waveColor: '#00FF00',
progressColor: '#FF0000'


wavesurfer.on('ready', function () {;
$('.waveform__duration').text( formatTime(wavesurfer.getDuration()) );

wavesurfer.on('audioprocess', function () {
$('.waveform__counter').text( formatTime(wavesurfer.getCurrentTime()) );


WaveForm generated using SOX

WaveForm Generator using SOX


Audiojs.swf?playerInstance audiojs instances [%27audiojs0%27]

Hits: 4386  

If you are using audio.js as MP3 player or playlist …. on some browser it causing error 403 to access SWF file with player instance[%27audiojs0%27]&datetime=1382426114401.4087

You need to make sure you have right permission on that SWF file and check JavaScript playerInstance below….

Firefox Error

403 Forbidden[%27audiojs0%27]&datetime=1382426114401.4087


Just replace code (Original audio.js)

flashSource: ‘\
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ id=”$1″ width=”1″ height=”1″ name=”$1″ style=”position: absolute; left: -1px;”> \
<param name=”movie” value=”$2?playerInstance=’+audiojs+’.instances[\’$1\’]&datetime=$3″> \
<param name=”allowscriptaccess” value=”always”> \
<embed name=”$1″ src=”$2?playerInstance=’+audiojs+’.instances[\’$1\’]&datetime=$3″ width=”1″ height=”1″ allowscriptaccess=”always”> \


flashSource: ‘\
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ id=”$1″ width=”1″ height=”1″ name=”$1″ style=”position: absolute; left: -1px;”> \
<param name=”movie” value=”$2?playerInstance=’+audiojs+’.instances[&quot;$1&quot;]&datetime=$3″> \
<param name=”allowscriptaccess” value=”always”> \
<embed name=”$1″ src=”$2?playerInstance=’+audiojs+’.instances[&quot;$1&quot;]&datetime=$3″ width=”1″ height=”1″ allowscriptaccess=”always”> \

This is not permission (0755 or 0777) error of SWF file, Make sure you have valid characters on some browsers…

instances[\’$1\’] => instances[&quot;$1&quot;] 😉

Media Streaming CMS

Hits: 12681  

WMSPanel is reporting and control cloud panel for Nimble Streamer and Wowza Streaming Engine. It’s also used as a control UI for Live Transcoder for Nimble Streamer


Kaltura, the Open Source Community provides tools such as: online video player, open source editor and open source video for websites.

Kaltura CMS
Kaltura CMS

EZserver is an Easy-to-Use Video Server to let you easily install, manage and provide video service. And, it is also integrated with IP Blocker, Player Filter, Time Shift, DVR, Subscriber Management and Middleware for IPTV / OTT and VOD service.

Ezhometech IPTV server, Video Server, IPTV player, IPTV Middleware

MEDIA CONTROL PANEL – supports all media server types including shoutcast, icecast, wowza media and windows media services.

cast control

Streamio – Online Video CMS – Managing HD video content on websites, intranets and social media networks.


ViMP is the professional Video CMS for WebTV, Social Media portals and Video Communities with mobile and HTML5 support. We also offer associated transcoding, hosting und dedicated servers.

vimp media product

Manage online videos with Brightcove’s video Content Management System (CMS). Learn how to sort, manage and organize your entire video library with ease.


Build a centralized, searchable video library with Panopto Unison. Import, edit, and manage video of any format in Panopto’s powerful video CMS.

Online Video Platform - Panopto

Installing Apache, MySQL, PHP in Gentoo Server

Hits: 9470  

All commands are performed as root to install Apache, MySQL, PHP and phpMyAdmin in Gentoo Linux Server.

1. Update your System

# emerge –sync

2. Install Apache Webserver

# emerge apache

The web server ROOT is in /var/www/localhost/htdocs/

# /etc/init.d/apache2 start

Then go to http://server-ip/
it works on gentoo

Add apache2 to the startup script
# rc-update -v add apache2 default

3. Install MySQL Database

# emerge mysql

Install MySQL database
# /usr/bin/mysql_install_db

Start MySQL Server
# /etc/init.d/mysql start

Change MySQL User Password
# /usr/bin/mysqladmin -u root -h localhost password ‘new-password’

Test MySQL Server
# /etc/init.d/mysql restart

Add MySQL to the startup script
# rc-update -v add mysql default

4. Install the PHP with modules

# USE=”cli cgi apache2 xml mysql mysqli” emerge ‘dev-lang/php’

Before you can use PHP with Apache… Edit /etc/conf.d/apache2 and add “-D PHP5″ to APACHE2_OPTS

It looks like

You can find php.ini in /etc/php/apache2-php5.4

then restart apache server
# /etc/init.d/apache2 restart

Then go to http://server-ip/info.php (Create phpinfo() file)

phpinfo on gentoo
phpinfo on Gentoo

phpinfo php

phpinfo mysql

5. Install phpMyAdmin

# emerge -av phpmyadmin

Then go to http://server-ip/phpmyadmin/

phpMyAdmin on gentoo
phpMyAdmin on Gentoo