S
S
Schoolboy.2015-10-16 20:54:54
linux
Schoolboy., 2015-10-16 20:54:54

How to run .sh file over ssh via php?

I found ssh2_connect () but I don’t understand how to use it, English documentation is everywhere. Maybe there is some example with a Russian description?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Everal, 2015-10-16
@viphorizon

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

unless of course the exec function is available, otherwise you can still use shell_exec to connect to ssh

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question