Running the application as administrator isn't necessarily the same as the user that is used for the access for the account. You need to ensure that the directory can be accessed by the user specified in the apache service.
What is the D drive? Is it local or drive mapped?
header('HTTP/1.1 420 Enhance Your Calm');