Please note
This is a very quick answer (a work in progress if you will), as I have not had time to test it, and it is way past my bed time. I will tidy up this answer tomorrow, once I have time to run it myself.
However...
I think (I may be wrong) that you are missing an export
to expose the GPIO pins to PHP. You may need to do
gpio export 29
Thus, your script will become
<?php
system("gpio export 29");
system("gpio -g mode 29 out");
system("gpio -g write 29 1");
?>
Try that.
I have just found a thread on the Pi forums, PHP GPIO Library, that says the same thing, so maybe I am correct. There are some other interesting points raised in that thread, which you may find useful.
However, the export command is not included in many other examples/tutorials, so maybe it is not the way forward. For example, from PHP on Raspberry Pi, this HTML/PHP script does not include the export
:
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>LED Control</title>
</head>
<body>
LED Control:
<form method="get" action="gpio.php">
<input type="submit" value="ON" name="on">
<input type="submit" value="OFF" name="off">
</form>
<?php
$setmode17 = shell_exec("/usr/local/bin/gpio -g mode 17 out");
if(isset($_GET['on'])){
$gpio_on = shell_exec("/usr/local/bin/gpio -g write 17 1");
echo "LED is on";
}
else if(isset($_GET['off'])){
$gpio_off = shell_exec("/usr/local/bin/gpio -g write 17 0");
echo "LED is off";
}
?>
</body>
</html>
Note: As PandaLion98 says in their comment, getting scripts to run in Apache can be dangerous, if they are publicly facing.
HIGH
or not? Does a simple php page work? Make sure that you can get a simple example (i.e.hello world) working first, before trying to access the GPIO. I will try to post a fuller answer tomorrow...