Here's a tiny section of php code:
if(file_exists('question.txt')) print("File exists<br>");
else print("File does not exist<br>");
$handle = fopen('question.txt', 'r') || die("Cannot open file");
print("fopen returns handle=[$handle]");
fclose($handle);
die("all done");
The result is
File exists
fopen returns handle=[1]
( ! ) Warning: fclose() expects parameter 1 to be resource, bool given in C:\wamp64\www\htdocs\NewCompany\ProofOfLearn\Development\test.php on line 6
Call Stack
# Time Memory Function Location
1 0.0002 362584 {main}( ) ...\test.php:0
2 0.0003 362696 fclose( $fp = TRUE ) ...\test.php:6
all done
In other words, fopen is returning TRUE, which is impossible
Of all the logs, only php.error.log shows an error, and it doesn't help
[16-Feb-2022 03:00:52 UTC] PHP Warning: fclose() expects parameter 1 to be resource, bool given in C:\wamp64\www\htdocs\NewCompany\ProofOfLearn\Development\test.php on line 6
[16-Feb-2022 03:00:52 UTC] PHP Stack trace:
[16-Feb-2022 03:00:52 UTC] PHP 1. {main}() C:\wamp64\www\htdocs\NewCompany\ProofOfLearn\Development\test.php:0
[16-Feb-2022 03:00:52 UTC] PHP 2. fclose($fp = TRUE) C:\wamp64\www\htdocs\NewCompany\ProofOfLearn\Development\test.php:6
And unlike many newbies with questions, I've been programming for 66 years, and this is the first time I've been stumped.