Hey I'm attempting to utilise the PHP SSH2 functions of which I've used a class from over a GitHub: Here but doesn't seem to be working as expected.
I'm trying to cd
into a directory and then list files, but seems to ignore the cd
and when I use the ls
command it just displays the root dir.
Here's when I perform a normal ls
on my root directory:
drwx------ 6 root root 4096 Aug 12 18:23 .
drwxr-xr-x 22 root root 4096 Aug 11 08:28 ..
-rw------- 1 root root 2963 Aug 12 18:33 .bash_history
-rw-r--r-- 1 root root 3106 Oct 22 2015 .bashrc
drwx------ 3 root root 4096 Aug 11 21:05 .cache
drwxr-xr-x 3 root root 4096 Aug 12 18:21 .local
drwxr-xr-x 2 root root 4096 Aug 12 18:22 .nano
drwxr-xr-x 18 root root 4096 Aug 11 21:07 myOtherDirectory
-rw-r--r-- 1 root root 148 Aug 17 2015 .profile
-rw------- 1 root root 1024 Aug 12 18:27 .rnd
-rw-r--r-- 1 root root 252 Aug 12 18:28 .wget-hsts
And here's then I try to access the myOtherDirectory
using SSH via PHP
$ssh = new ssh("ip", "root", "pass");
$ssh("cd myOtherDirectory");
$result = $ssh("ls -la");
print_r($result);