Arduino and PHP

Every time you invoke that script, it opens the serial port. Opening the serial port resets the Arduino.

As soon as PHP opens the port, it jams out the data ("on"), if required, and then ends.

The Arduino hasn't even finished resetting when the PHP script sends the data, so the data is lost.

Try adding a link to open the port, one to send data, and one to close the port.

Before sending data, test that the port is still open. Wait long enough for the Arduino to reset before clicking the send data link.