I'm trying to create something based on ssh2 connecting to my vps and then creating some files and running them with exec commands.
I already finished a bigger part which is creating a directory moving files from one directory to another now I need to do something like this
cd directory previously created
nohup ./samp03srv
but how can i do this with php ?
this is what i got so far
$ssh = new SSH2($request->ip);
if (!$ssh->login("root", "password"))
{
return back()->withErrors("Authentication failed! Please check your credentials!");
}
$randomNum = substr(str_shuffle("0123456789abcdefghijklmnopqrstvwxyz"), 0, 11);
$src = $request->path;
$dest = "/home/servers/$randomNum";
$ssh->exec("cp -r $src $dest");
$ssh->disconnect();
If you need more info please ask!