So first of all I have 2 Servers:
- Raspberry pi
- Linux Debian server
The pi has a script that displays the current Temperature in a room.
This is the script :
#!/bin/bash
i2cset -y 1 0x48 0xEE
dte=$(date +%Y-%m-%d)
tme=$(date +%H:%M:%S)
hexraw=$(i2cget -y 1 0x48 0xAA w)
msb=$(echo ${hexraw:4:2})
lsb=$(echo ${hexraw:2:1})
dec=$(printf "%d\n" "0x$msb$lsb")
temp=$(echo "scale=1; $dec/16" | bc)
echo $temp
exit
Displaying the temperature on the pi's website works fine. But then I have another script on the linux server that takes the value of the pi's script:
#!/bin/bash
x=$(ssh [email protected] sudo /home/pi/CurrTemp;)
echo $x
This works too. But when I want to display the Temp on my Linux server website(with shell_exec()) it doesn't work. The var_dump is empty.
PHP:
I've tried to write it with a "sudo".
I've changed the script owner to root.