Marvin_G Posted February 20, 2013 Share Posted February 20, 2013 hello guys, i'm using system() command in php to execute command in terminal through php but it seems like there's a problem occured. Below is the simple code in php <?php$command = system('perl -e' print "\xF5\x01\x00\x01\x03\x00\x03\xF5"'>/dev/ttyUSB0 '); ?> it suppose send command to the serial port and light up my LED but it seems like nothing happened. Please share your idea guys. Thank you. Link to comment Share on other sites More sharing options...
Ingolme Posted February 20, 2013 Share Posted February 20, 2013 Have you checked the value of $command to see if it worked? Actually, notice that random "print" command in your function. That's likely to give a syntax error. Check that your strings are properly quoted. Link to comment Share on other sites More sharing options...
Marvin_G Posted February 23, 2013 Author Share Posted February 23, 2013 Have you checked the value of $command to see if it worked? Actually, notice that random "print" command in your function. That's likely to give a syntax error. Check that your strings are properly quoted. i've tried the code in terminal and it works Link to comment Share on other sites More sharing options...
jeffman Posted February 23, 2013 Share Posted February 23, 2013 Are you using a *nix system? Have you tried exec() or shell_exec() instead of system() ? Does PHP/web user have the correct user permissions? Link to comment Share on other sites More sharing options...
justsomeguy Posted February 25, 2013 Share Posted February 25, 2013 The code you posted has syntax errors, your quotes are not matched and escaped correctly. You have a single quote after -e which is ending the string. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now