For testing the balena-cli part, it’s easier to first run your scripts on the command line (ex. running php test.php).
This will show you the actual output of your commands.
When you have that part working, you can look into setting up your server and how to include the scripts in your pages.
on the server shell, the balena devices prints all devices as awaited. (balena login has been executed some days ago).
what do you mean by setting up the server ?
I am assuming your issue relates to your webserver (which hosts the file) not processing the PHP properly when requesting the file.
If you simply open the file in your browser without actually running a server, this will also be the case.
I can recommend reading through the PHP getting started guide if this is new.
If you want a simple setup for developing PHP sites, you may want to try XAMPP.
It’s difficult to help without more details about the setup in which you’re trying this.