3

I am using the laravel Task functions to run some code using phantomjs and then using the output. The code is executed using a artisan command.

This is a part of the code I use:

private static function phantomjs($file, $c, $a)
{
    SSH::run(array("phantomjs " . base_path("phantomjs/" . $file)), function($line)
    {
        $json = json_decode($line);
        DataHelper::saveJson($json);
    }
}

Whenever I run the command I get the following error on this piece of code:

[ErrorException]
Expected SSH_FXP_VERSION

If I output the command and run it in a terminal myself it works just fine.

Does anyone know if I need to change some configs or if my code is incorrect? I have already been able to do ssh for executing nodejs scripts.

I am using Debian 7.6 on my server.

Thanks for helping. :)

neubert
  • 15,947
  • 24
  • 120
  • 212
Jerodev
  • 32,252
  • 11
  • 87
  • 108
  • SFTP is a subsystem of SSH. Just because a server has SSH running doesn't mean it has SFTP. In the servers `/etc/ssh/sshd_config` look for a `Subsystem` section and see if sftp is there. If not add it. – neubert Nov 12 '14 at 14:10
  • This line is in my `/etc/ssh/sshd_config`: `Subsystem sftp /usr/lib/openssh/sftp-server` – Jerodev Nov 12 '14 at 14:21
  • That looks correct. Maybe try doing `sudo service ssh restart`? Also, are you able to connect with SFTP with any other clients? – neubert Nov 12 '14 at 14:27

1 Answers1

0

for me it was a problem with the path of sftp-server, instead of /usr/lib/openssh/sftp-server i used /usr/libexec/openssh/sftp-server

soufyane
  • 1
  • 1
  • 3