[GH-ISSUE #26] Cant figure out how to create LXC #20

Closed
opened 2026-02-26 17:32:08 +03:00 by kerem · 0 comments
Owner

Originally created by @OfflinePing on GitHub (Sep 2, 2023).
Original GitHub issue: https://github.com/Corsinvest/cv4pve-api-php/issues/26

Hey,
I am trying to make a Container with this Libary.
This is the Code I have

if (isset($_POST['createContainer'])){
    $client = new Corsinvest\ProxmoxVE\Api\PVEClient('10.250.50.150');
    if ($client->login("root", "ultrasecurepasswordlol")) {
        $client->setResponseType('json');
        $client->setResultIsObject(false);
        echo '<div class="alert alert-success" role="alert">Container is creating...</div>';
        $id = $client->getCluster()->getNextid()->nextid()->getResponse();
        var_dump($client->getNodes()->get('pve-claas')->getLxc()->createVm(ostemplate: 'debian-11-standard_11.7.1_amd64.tar.zst',  vmid: $id['data'], rootfs: "local-lvm")->getError());
    } else {
        echo '<div class="alert alert-danger" role="alert">An Error Occurred.</div>';
    }
}

EDIT: I had to set storage to local-lvm lol <3

why doesnt it create it tho? the vardump prints out: string(0) ""
Thanks in advance

Originally created by @OfflinePing on GitHub (Sep 2, 2023). Original GitHub issue: https://github.com/Corsinvest/cv4pve-api-php/issues/26 Hey, I am trying to make a Container with this Libary. This is the Code I have ``` if (isset($_POST['createContainer'])){ $client = new Corsinvest\ProxmoxVE\Api\PVEClient('10.250.50.150'); if ($client->login("root", "ultrasecurepasswordlol")) { $client->setResponseType('json'); $client->setResultIsObject(false); echo '<div class="alert alert-success" role="alert">Container is creating...</div>'; $id = $client->getCluster()->getNextid()->nextid()->getResponse(); var_dump($client->getNodes()->get('pve-claas')->getLxc()->createVm(ostemplate: 'debian-11-standard_11.7.1_amd64.tar.zst', vmid: $id['data'], rootfs: "local-lvm")->getError()); } else { echo '<div class="alert alert-danger" role="alert">An Error Occurred.</div>'; } } ``` EDIT: I had to set storage to local-lvm lol <3 why doesnt it create it tho? the vardump prints out: string(0) "" Thanks in advance
kerem closed this issue 2026-02-26 17:32:08 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cv4pve-api-php#20
No description provided.