A problem i’ve been fidgeting with all weekend… Seems PHP 5.5 and jQuery suddenly got fussy about handling JSON data.

The short version… in jQuery use $.ajax() instead of $.getJSON()

PHP Side

// $group array needs all strings to be UTF-8 encoded.
print json_encode($group, JSON_FORCE_OBJECT, 3);

jQuery Side

    type: "POST",
    url: "_apget.php",
    contentType: "application/json; charset=utf-8",
    dataType: "json",    
    success: function(data) {
        for (var index in data) {
    error: function(jqXHR, Status, Error) {
        alert("Status: "+Status+" Error: "+Error);

This is a post to cover off a few issues I encountered trying to build an ntopng server on CentOS 6.5

Firstly, you need to install the EPEL 6 repository.

yum -y install http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Then you need to add the ntop repository (manually)

vi /etc/yum.repos.d/ntop.repo

name=ntop packages

Update your repositories and install ntopng and its dependencies

yum clean all
yum update
yum install pfring n2disk nProbe ntopng ntopng-data nbox

*Note: At this point I had a Transaction Check error because my kernel was newer than what the ntop compile expected, so I had to install an older kernel for the yum install to complete. If the above completes without an error you can skip this step, else grab the older kernel and try the package install again.

yum -y install kernel-

Once installed, you want to edit the configuration files.

vi /etc/ntopng/ntopng.start

--local-networks ""
--interface 0

and copy the default configuration

cp /etc/ntopng/ntopng.conf.sample /etc/ntopng/ntopng.conf

You’re pretty much done, except for a bit of housekeeping.

Set the services to start automatically.

chkconfig redis on
chkconfig ntopng on

Add an exception to the firewall

vi /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT

Restart the firewall

service iptables restart

and Start the ntopng services…

service redis start
service ntopng start


Browse to the server http://youserver:3000
Login with admin/admin

Thanks to RedBranch, Nmon and others for helping me piece this together.

Installing a WIMP server just got heaps easier thanks to the Microsoft Web Platform Installer.

Go grab it, run it on your Server 2012R2 instance and install the PHP 5.5.3 and MySQL components.

It will setup your IIS install with PHP, FastCGI module and WinCache extensions and save you heaps of time and fuss. The PHP management addin for IIS Management Console is a nice touch also, as you can change all the php.ini parameters, enable/disable extensions etc. right in the management GUI.

The only catch I found was that the PHP binaries and FastCGI module need the x86 and x64 Visual C++ Runtimes, which the WebPI installer doesn’t fetch? Anyway, grab them as well and you should be good to go.

Here’s a snippet of PHP Code I’ve been using to interrogate our switches SNMP data for graphing.

/* HP MSM Controller */
$ip = '';
$oid = 'iso.'; //ap's

/* HP Procurve Switch */
//$ip = '';
//$oid = 'iso.'; //ports
//$oid = 'iso.'; //inoct
//$oid = 'iso.'; //outoct

/* SNMP Tree Walk */
$res = snmp2_real_walk($ip,'public',$oid);
while (list($key, $data) = each($res)){
 list($attr,$int) = explode('.',substr($key,strlen($oid)+1));
 $group[$int][$attr] = $data;

/* SNMP Value fetch example (Switch Port Traffic In/Out) */
$desc = snmp2_get($ip,"public","iso.".$port,300);
$inoct = snmp2_get($ip,"public","iso.".$port,300);
$outoct = snmp2_get($ip,"public","iso.".$port,300);

 print_r($res); // Raw result
// print_r($group); // Parsed Array


If you need to add a 3rd Party SSL certificate to Windows for whatever reason (Exchange, IIS, TLS, SSL, SFTP, NAP, RAS, etc.) here’s how you can go about getting one ready to use.

Of course, First you’ll need to go buy a valid certificate from your friendly neighbourhood provider.

I can recommend RapidSSL, they’re backed by GeoTrust, recognised by 99.9% of devices and are cheap as chips. Especially for wildcard domains.

Anyway, once you’ve got confirmation you can proceed with generating a Certificate Signing Request (CSR).

Read the rest of this entry »

Brew In A Bag

Someone asked me how I brew my beer. The answer being; I make my own malt extracts by mashing grains – and keep everything simple by doing it all in one pot (mash tun) using the ‘Brew in a Bag’ method.

I’m by no means an expert at this but this method makes great beer and it’s no hassle once you have the routine down.


1x 20L or larger Pot (preferably with temp gauge fitted)
1x Large Nylon bag
1x Cooling coil
1x 4L Bottle (or equivalent water containers)

Read the rest of this entry »

The first thing I say to anyone trying to better their understanding of photography is to first stop and consider what it is they are actually doing.

Photography = from the greek photos (light) and graphos (writing or painting).

Photography is the process of painting with light.

Whether you have a lot of light, or barely any at all; will dictate entirely the kinds of images you can produce. Understanding the light in your environment and how light works inside the camera is paramount to being able to select the right mode/settings and achieve the kind of shot you want.

Read the rest of this entry »

While CentOS’ default repository comes with heaps of useful services, there is more value to be added by adding the Extra Packages for Enterprise Linux repository as well.

Adding the repository is easy…

yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

A list of the EPEL (x86_64) packages can be found here, but some of the more popular ones you might be interested in, include…

  • phpMyAdmin
  • shellinabox
  • nginx
  • zabbix
  • ettercap
  • apcupsd

Installing phpMyAdmin

Install the package

yum -y phpMyAdmin

Edit the phpMyAdmin configuration file to allow access to the interface.

vi /etc/httpd/conf.d/phpMyAdmin.conf

Find the existing Require and Allow criteria and substitute your own management IP Address. Conversely if you want to allow access from anywhere (probably not a good idea, but hey – it’s your server) you can substitute these rules instead.

Require all granted
Allow from all

..finally don’t forget to restart the webserver.

service httpd restart


With malware systems scanning for server vulnerabilities all the time (like Windigo), it’s important to secure your server wherever possible. Especially at the shell level and double if you have SSH facing the internet.

Check the security guide at CentOS’s website…


More How-To’s can be found here…


Following up on my CentOS 6.5 WebServer tutorial, here’s how you can get a Multisite WordPress installation up and running muay pronto!

Read the rest of this entry »


Get every new post delivered to your Inbox.