Adding SSH support to PHP on Ubuntu

I have previously written a post on how to add SSH support to PHP, but that post is old, and it has now become even easier to get it up and running. And therefore making it much easier to auto upgrade WordPress via SSH. (automatic, yay!)

As root, do the following:

1: apt-get install libssh2-1-dev libssh2-php

2: Check that is installed: php -m |grep ssh2

3: Restart apache: service apache2 restart

And you should now have SSH support in PHP.

Display clock each 10 minutes x times forward in PHP

Here is a simple code PHP snippet to display the clock each 10 minutes x times in the format of:

php5 test.php
20:40
20:50
21:00
21:10
21:20
21:30
21:40

Etc.

<?php

$j = 0;
for($i=0;$i<10;$i+=1) {
        $j += (10*60);
        $hour = date("H", (time()+$j));
        $min  = ceil((date("i", (time()+$j))/10))*10;
        if($min > 50) {
                $min = "00";
                $hour++;
        }
        echo $hour.":".$min."n";
}

?>