I'm making a simple home automation system with my Beagle Bone, raspberry pi and a hand full of components. I have a simple interface on a webpage and i'm currently trying to remotely toggle a relay. Right now I have a button on the webpage that uses php to call a python script that either turns the relay on or off depending on a boolean. 
I'm having trouble figuring out the best way to share this boolean. Is there any way to pass a php varible into the python script? or is there anyway to have the python interpreter "keep/save" the state of the variable in-betweeen instances of the script. Or is the best way just to have it write/read from a common file? any help would be awesome
I am unfamiliar with php, but could you have php write to a temporary text file, and then when that python script gets called, it simply reads in that text file to store the boolean value?
Best way to share a variable with multiple instances of the same python script