My basic idea is to read the input and output from the Arduino to the next in the transfer to the PHP / Javascript.
Right from the beginning, this does not make sense.
The Arduino can read serial data and it can send serial data. It cares not a whit what is sending it data, or what it is sending data to, except that there can only be one thing on the other end of the serial port.
PHP and Javascript are completely separate things.
Start by describing what is sending serial data to the Arduino, and what you want the Arduino to do with that serial data.
A mention of which Arduino you are using, on what operating system, with what version of the IDE, running what sketch, would be useful, too.