php serial port fread does not work in windows 11

Jhon Castillo 0 Reputation points
2023-10-20T15:06:37.4366667+00:00

I have the following code:

<?php
exec("mode COM1 BAUD=9600 PARITY=N data=8 stop=1 xon=off");
$buffer_ = 8;
$substr1 = 1;

$fp = @fopen ("COM1", "w+");
if (!$fp) {
$status = "Not connected";
} else {
$status = "Connected";
$buffer = fread($fp, $buffer_);
$weight = substr($buffer, $substr1);
}
echo $status;
echo $fp;
echo $buffer;
echo $weight;
?>

Everything works fine for me until Windows 10. When I moved the application to Windows 11, it stopped taking the data via COM from the scales, a 0-byte file is created with the name of the COM port, it is also validated that it is connected to the COM but it is not The buffer of what it receives works only in Windows 11.

If you could tell me if there is any restriction for this process so that we can give you the necessary access for this application to work for me.

thank you

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,447 questions
0 comments No comments
{count} votes