SSL certificate problem: self signed certificate in certificate chain

Go to http://curl.haxx.se/ca/cacert.pem 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:

[cURL] 
curl.cainfo="D:\xampp\php\cacert.pem"

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

https://laracasts.com/discuss/channels/laravel/how-to-solve-curl-error-60-ssl-certificate-in-laravel-5-while-facebook-authentication

http://stackoverflow.com/questions/17478283/paypal-access-ssl-certificate-unable-to-get-local-issuer-certificate

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

Source: http://forums.cpanel.net/f5/how-instal-gd-library-114941.html

 

Permutations – get all possible sets of numbers

http://stackoverflow.com/questions/5506888/permutations-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:

ip = $_SERVER['REMOTE_ADDR'];
$details = json_decode(file_get_contents("http://ipinfo.io/{$ip}"));
echo $details->city;

 

jQuery example:

$.get("http://ipinfo.io", function(response) {
    console.log(response.city);
}, "jsonp");

 

Source: http://stackoverflow.com/questions/409999/getting-the-location-from-an-ip-address#answer-17864552