Answer the question
In order to leave comments, you need to log in
Can't login via ssh and execute command from php
There is a server with nginx + php-fpm, there is a simple page that does something like
<?php
$uname = `ssh -i /var/www/.ssh/id_rsa [email protected]192.168.11.1 uname -a | awk '{print $3}'`;
echo $uname;
?>
[email protected] ~ $ ssh -i /var/www/.ssh/id_rsa [email protected] uname -a | awk '{print $3}'
3.8.1 - gentoo
[email protected] ~ $ php /home/share/www/www/index.php
3.8.1-gentoo
Answer the question
In order to leave comments, you need to log in
Are you sure that php is being executed by the nginx user?
PS: maybe not php-ftp, but fpm?
Try to specify the full paths to the running utilities. Perhaps the environment variables are not being passed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question