Arduino and PHP communication only work if I open the Arduino IDE I have a problem. I try to open a channel to arduino and PHP talk, the PHP would send a command and the Arduino should answer that. It works, but only if I execute some steps before: 


sudo chmod 777 /dev/ttyACM0 
sudo arduino 
Open the serial monitor in arduino IDE 
Close the serial monitor 
Now everything is ok, they can talk


The first step is ok, I really need to do this, the 2-4 seems irrelevant, but the communication do not start without it. I put one LCD in arduino to print what he receive, when I send "HEYARD" with PHP to him, the RX led blinks and the TX led also, but nothing is printed on LCD. If I do the 2-4 steps, when PHP send "HEYARD", LCD show HEYARD and arduino answer with "HEYPHP"

Anyone could help? There is some way to open it via Terminal, or, at least, open the Serial Monitor from arduino and close to see if this start
Here the setup block:

&lt;?php 
    require("php_serial.class.php");
    $serial = new phpSerial();
    $serial-&gt;deviceSet("/dev/ttyACM0");
    $serial-&gt;confBaudRate(9600);
    $serial-&gt;confParity("none");
    $serial-&gt;confCharacterLength(8);
    $serial-&gt;confStopBits(1);
    $serial-&gt;confFlowControl("none");
    $conect = mysql_connect("localhost", "root", "") or print (mysql_error()); 
    mysql_select_db("ANM", $conect) or print(mysql_error()); 
?&gt;


And here the connection block:

&lt;?php 
    $serial-&gt;deviceOpen();
    exec("echo 'HEYARD' &gt; /dev/ttyACM0");
    sleep(1);
    $read = $serial-&gt;readPort();
?&gt;