在Windows上读取串行端口

I am trying to use PHP to read weighing machine value(i.e., weight). Whenever I run the code below, it says

Fatal error: Maximum execution time of 300 seconds exceeded

I did something wrong, I don't know where it is?

The PHP Serial class offers a readPort() function, does not return (My assumption).

My PHP code:

<html>
<body>
<h1>Works with php</h1>
<p>First Page in PHP</p>

<?php
include 'PhpSerial.php';

    $serial = new phpSerial();
    $serial->deviceSet("COM3");
    $serial->confBaudRate(9600);
    $serial->confParity("none");
    $serial->confCharacterLength(8);
    $serial->confStopBits(1);
    $serial->confFlowControl("none");
    $serial->deviceOpen();
    $serial->sendMessage("s");

    $read = $serial->readPort();
    echo ("Weight--->".$read );
    $serial->deviceClose();
?> 

<p>Sent Data to server </p>

</body>
</html>

try like this:

require_once 'PhpSerial.php';
$serial=new phpSerial();
$serial->deviceSet('/dev/ttyACM2');
$serial->confBaudRate(9600);
$serial->confParity("none");
$serial->confCharacterLength(8);
$serial->confStopBits(1);
$serial->confFlowControl("none");
$serial->deviceOpen();

if($_GET['status']){
    $serial->sendMessage($_GET['status']);
    $read=$serial->readPort();

    var_dump($read);
    echo $read;
}