Jump to content

CyborgHamster

New Members
  • Posts

    2
  • Joined

  • Last visited

CyborgHamster's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. THANK YOU!!!! It was so simple but I over looked it. I had tried adding the user apache to the group but was getting a user error. Then I ran ps aux | egrep '(apache|httpd)' which showed me that the user was www-data. Then I added www-data to the group dialout using sudo usermod -a -G dialout www-data and after I logged out and back in it works!
  2. Hello, I am using php to write to Arduino via a serial port (/dev/ttyACM0). The problem that I ran into is that I keep getting an Access Denied error in the log for the port. If I chmod the port, I can then write to it, but that only lasts until I make a change to the Arduino code or reset the device or computer. I tried adding myself to the dialout group and the uucp group like some sites suggested, but I still can not write to the port unless I chmod it first. I can also write to the port using python without any errors. Is their a way to force php to always allow me to write to that port? Here is the php code <?php $verz="1.0"; $comPort = "/dev/ttyACM0"; /*change to correct com port */ if (isset($_POST["rcmd"])) { $rcmd = $_POST["rcmd"]; switch ($rcmd) { case "ON": $fp = fopen($comPort, "w") or die("Can't Open Port"); fwrite($fp, "1"); sleep(1); fclose($fp); break; case "OFF": $fp = fopen($comPort, "w"); fwrite($fp, "0"); sleep(1); fclose($fp); break; } } ?> <html> <body> <center><h1>Arduino from PHP Example</h1><b>Version <?php echo $verz; ?></b></center> <form method="post" action="index.php"> <input type="submit" value="ON" name="rcmd"> <input type="submit" value="OFF" name="rcmd"> </form> </body> </html> and here is the error [Tue Oct 22 14:19:10 2013] [error] [client 127.0.0.1] PHP Warning: fopen(/dev/ttyACM0): failed to open stream: Permission denied in /var/www/arduino/index.php on line 10, referer: http://127.0.0.1/arduino/index.php Any help would be appreciated, Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.