I can't tell if your PHP script is running as the web server (apache) or whether you are trying to launch your PHP script from the command line or using cron or something. However PHP runs, it runs as some user. You can find out which user your script runs as with some code like this:
<?php
exec('whoami', $output, $return);
if ($return) {
die('return is nonzero, command failed');
}
print_r($output);
?>
Once you know which user your script runs as, you need to give permission to that user to WRITE your network drive. There could be an issue with the fact that it's a network drive. The drive will need to be mounted and available for writing at the time the script runs.
To change the ownership of a file, you'll need to figure out how to do that in windows. This will likely need to be done by someone with admin permission on the machine that contains the network drive.