Jump to content

system() in php


Marvin_G

Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...