Can PHP access files on local system drives?

Yes, PHP can access files on local system drives by using the file system functions provided by PHP such as fopen, fread, fwrite, etc. However, it is important to ensure that proper permissions are set on the files and directories being accessed to prevent security vulnerabilities.

$file = 'path/to/file.txt';

if (file_exists($file)) {
    $handle = fopen($file, 'r');
    $contents = fread($handle, filesize($file));
    fclose($handle);
    
    echo $contents;
} else {
    echo 'File does not exist.';
}