SSL certificate problem: self signed certificate in certificate chain

Go to and download the pem file and save in your php installation directory ( make sure while saving it retains the extension and not saved as a text file )

Now, open your php.ini file, scroll to the bottom and add the following line:


Replace D:\xampp\php\cacert.pem with the actual path.

Installing GD library using CPanel


If you need to enable imagecreatefromjpeg on CPanel hosting, then do the following…

  • Go to WHM -> Software -> EasyApache
  • If prompted to upgrade, do so then repeat the above step
  • Begin customizing based on the current provile
  • Proceed through the screens until you get to “Step 5″
  • On “Step 5,” click on “Exhaustive Options”
  • Under PHP, check the checkbox for GD
  • Proceed with Build & Compile Process



Permutations – get all possible sets of numbers

pc_permute(array(0, 1, 2, 3, 4, 5, 7, 8));

function pc_permute($items, $perms = array( )) {
    if (empty($items)) {
        print join(' ', $perms) . "\n";
    }  else {
        for ($i = count($items) - 1; $i >= 0; --$i) {
             $newitems = $items;
             $newperms = $perms;
             list($foo) = array_splice($newitems, $i, 1);
             array_unshift($newperms, $foo);
             pc_permute($newitems, $newperms);

#nPk = n!/(n-k)!

Getting user location from an IP address

Want to retrieve information like the city, state, and country of a visitor from their IP address?

PHP example:

$details = json_decode(file_get_contents("{$ip}"));
echo $details->city;


jQuery example:

$.get("", function(response) {
}, "jsonp");