PHP code example of deaduseful / openvz-client

1. Go to this page and download the library: Download deaduseful/openvz-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

deaduseful / openvz-client example snippets


    $vz = new OpenVz/Client();
    print_r($vz->connect('server.domain.com', 'username', 'p4ssw0rd', 22));
    print_r($vz->su());
    print_r($vz->listvz());
    print_r($vz->listos());
    print_r($vz->exists('123'));
    print_r($vz->create('123', 'centos-4-i386-minimal', '192.168.50.51', 'n3wr00tp4ssw0rd'));
    print_r($vz->set('123', array('diskspace'=>'430209:433209', 'cpulimit'=>'20%')));
    print_r($vz->stop('123'));
    print_r($vz->start('123'));
    print_r($vz->restart('123'));
    print_r($vz->destroy('123'));

    $ssh = new Ssh/Client();
    $ssh->connect('host');
    $ssh->auth('user', 'password');
    $ssh->shellExecute('ps auxfc; ls');
    $ssh->disconnect();