Serial communication with PHP

Keep in mind that opening a serial connection resets the Arduino, as does closing the connection, unless you have modified the Arduino.

You should not open and close the connection before and after every send/receive of data.

Also, you need to allow time for the Arduino to reset before you send it data, or that data will be lost.