While running the Raspberry Pi 2-B off the drill battery, I installed the Apache-2 server and MySQL.
See http://elinux.org/RPi_Apache2 for details.
I want to run the temperature and humidity logging, IR and USB cameras, and other possible instruments like weight measurement from a local web server on the remote RPi. The first step is to run a PHP script on the server, which in turn selects the “driver” code for the attached devices. The learning PHP script runs a simple Python script.
See http://stackoverflow.com/questions/19735250/running-a-python-script-from-php for the basic ideas.
I wrote the PHP script “index.php”, which is placed in the RPi directory /var/www, where the Apache server runs it as the default start up code instead of index.html.
echo “hello world.”;
$command = escapeshellcmd(‘python test2.py’);
$output = shell_exec($command);
echo “<br> I’m here in php”;
The Python script “test2.py”:
print “I’m here in Python”
When the IP address of the RPi is entered into the Firefox browser, this is the result: