SSH connection via PHP - Laravel
If your actually can log in via "Try 2" you should run the code differently. Append your command with your ssh command. What you are doing now is first running ssh (which probably hangs) and then running "mkdir" when ssh finishes. Instead:
SSH::into('S1')->run(['ssh -tt -p 2222 myRemoteUser@myRemoteIp "cd && mkdir testDir"'])
(I also added cd
to make sure you are in your home directory.