I'm trying to create a class for work with crontab in php. I used this tutorial.
I've installed libssh2 but as you can see there is no work with it yet. So I have a file Ssh2_crontab_manager.php on my server. Here it's content:
<?php
Class Ssh2_crontab_manager
{
private $connection;
private $path;
private $handle;
private $cron_file;
function __construct($host=NULL, $port=NULL, $username=NULL, $password=NULL)
{
$path_length = strrpos(__FILE__, "/");
$this->path = substr(__FILE__, 0, $path_length) . '/';
$this->handle = 'crontab.txt';
$this->cron_file = "{$this->path}{$this->handle}";
/*try
{
if ((is_null($host)) || (is_null($port)) || (is_null($username)) || (is_null($password))) throw new Exception("Please specify the host, port, username and password!");
}
catch
{
}*/
}
}
?>
And here is noReplyCrontab.php where I try to use this class:
<?php
include './lib/Ssh2_crontab_manager.php';
//$crontab = new Ssh2_crontab_manager('host', '22', 'user', 'pass');
echo 'WORKS';
?>
If I run it now, it says 'works', but if I uncomment try/catch block it shows just white screen, so I suppose that there is some mistake. Any one can show it to me?