Answer the question
In order to leave comments, you need to log in
How to remotely get the time of a Debian server?
Hi all. There is a server with Debian installed. There is access to it via ssh. You need to somehow reach the server from PHP and get something like a response to the date command from it. Only without the console. Tried CURL - it doesn't output anything. I use ssh2 to get files from the server. Pliz, prompt: where to dig? Thanks to all!
Answer the question
In order to leave comments, you need to log in
execute via exec or whatever in php
, this works for me, except that the keys are configured.
ssh [email protected] "date"
As a result, it turns out something like
https://www.php.net/manual/ru/function.shell-exec.php
<?php
$output = shell_exec('ssh [email protected] "date"');
echo "<pre>$output</pre>";
?>
Run a tiny web server on it that responds to a request with the current system time?
If we are talking about php and ssh, use https://www.php.net/manual/ru/function.ssh2-exec.php to run date and get the result.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question