What steps can be taken to properly delete files using PHP scripts and set appropriate permissions?

When deleting files using PHP scripts, it is important to ensure that the proper permissions are set to prevent unauthorized access. To do this, you can use the `unlink()` function to delete the file and then use `chmod()` to set the appropriate permissions on the file.

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

// Delete the file
if (file_exists($file_path)) {
    unlink($file_path);
}

// Set appropriate permissions
chmod($file_path, 0644);