raphael75 Posted May 5, 2014 Share Posted May 5, 2014 I'm using a PHP script from the command line to copy files from a mapped drive on a remote computer to a folder on the local computer where PHP is running. I get an "Access is denied (code: 5)" error.When PHP runs from the command line, is it using the same user account it runs with when it runs in the browser?How can I tell if the access is denied on the remote side or the local side?What account would need to have read/write permissions set?Thank you! Quote Link to comment Share on other sites More sharing options...
requinix Posted May 5, 2014 Share Posted May 5, 2014 PHP will be run as whatever user started it. If you ran it yourself, manually from the command line, then it will run as your user. When run by a web server (eg, when accessed through a browser) then it will run as whatever user the web server is running as: Apache is probably running as LOCAL_SYSTEM (which does not have networking privileges, so I suspect this is your problem) while IIS will run as a specific user account dedicated it (like "IUSR" or "IUSR_machine"). The best solution that I know for Apache on Windows is to create a brand-new user account just for it - so much like how IIS runs. The account will have networking privileges by default and your script should be fine. From there you can even manage file and directory permissions. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.