use relay-expansion with php?
-
<?php system('relay-exp all 1');
mcp-driver:: read from addr 0x00 failed > ERROR: Relay Expansion not found!
Trying to initialize the expansion:
<?php system('relay-exp -i');
> Initializing Relay Expansion chip mcp-driver:: writing value 0x00 to addr 0x00 failed relay-exp:init:: Setting output direction failed main-relay-exp:: relay init failed!
Running the same code on console works great, even without initializing
/usr/bin/php-cgi script.php
X-Powered-By: PHP/5.6.17
Content-type: text/html; charset=UTF-8> Setting both RELAYS to ON
Can someone explain why this does not work via website/apache?
-
I think the problem is that apache is running as nobody and the relay-exp is only accessible from root.
Changing apache to run as root is not possible without rebuild...
... Apache has not been designed to serve pages whil running as root. There are known race conditions that will allow any local user to read any file on the system. If you still desire to serve pages as root then add -DBIG_SECURITY_HOLE to the CFLAGS env variable and then rebuild the server.
Is there a solution?