You don't have an active console when invoking the script from php
. Add the -tt
switch to your ssh
command.
-t Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.
Source: man ssh
manpreet
Best Answer
2 years ago
I have 3 href="https://forum.tuteehub.com/tag/scripts">scripts (I have removed the help_page function from the networkstats.sh script when I pasted here to save some space):
api3.href="https://forum.tuteehub.com/tag/php">php
getnetworkstatsin.sh
networkstats.sh
The problem I have is that when I execute the api3.href="https://forum.tuteehub.com/tag/php">php script from console, it is able to execute and return a value.
However when I try and execute from a webpage it fails to return anything.
I believe it is not even executing when I load it via the webpage by navigating to localhost/api3.href="https://forum.tuteehub.com/tag/php">php. Can someone help, what is the reason behind this? I have added
To my visudo section, I have tried to change permissions of all files involved to 777 (temporally) without success.
All these href="https://forum.tuteehub.com/tag/scripts">scripts are located inside /usr/share/href="https://forum.tuteehub.com/tag/nginx">nginx/status which href="https://forum.tuteehub.com/tag/nginx">nginx has access to.