How to run a .sh file over ssh via php?

  • 0
    Found ssh2_connect () but don't understand how to use it, English documentation everywhere. Maybe there is some example with a Russian description?
    Ubuntu Anonymous, Jan 20, 2020

  • 1 Answers
  • 0
    <?php
    $result = exec ('/var/www/up.sh');
    echo $result;
    if ($result)
    {
    echo "Все хорошо.";
    }
    if (!$result)
    {
    echo "Ошибка.";
    }
    ?>



    unless of course the exec function is available, otherwise use either to connect to ssh.

    you can still try shell_exec
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!