Windows 10, под Ubuntu 18.04.3 LTS проверял только на PHP 7.4
error_reporting(E_ALL);
$path = "./file";
file_put_contents($path, "stuff");
$file = fopen($path, "r");
flock($file, LOCK_EX);
unlink($path);
PHP 5.6
Warning: unlink(./file): Permission denied in ...
PHP 7.2
Warning...