I cannot figure out, how to pass parameters to PHP
exec function that I use to run scripts via website.
After some googling I ended up with this:
exec("nohup sudo python /home/pi/Python/RGB_Controller/write_color.py ".$HEX." &", $status); print_r($status);
This script simply takes the parameter and writes it into .txt file (if there is parameter). When I run it via bash it works as expected. But when I run it with
exec the file is not changed.
Running scripts without parameters works fine. This also does not work:
exec("nohup sudo python /home/pi/Python/RGB_Controller/write_color.py test &", $status);
EDIT: Dammit. So the problem was elsewhere. In my python script that writes the file I had only relative filepath for my file. So it worked probably many times when I tried. Only the data.txt file was being created in the server root directory and thus never updating the one in my Python folder.