Arduino and PHP communication only work if I open the Arduino IDE
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;