I'm having some difficulty getting PHP (or more specifically, Python via PHP) to recognize an important network location. I'm trying to make a simple website which will allow users to easily execute Python scripts, most of which make use of this network location. PHP executes the Python scripts, and then will display anything printed by the Python scripts. For testing purposes, I've made a very simple python script: First, it authorizes access to the location with the command:

NET USE \\servername\directory password /USER:username

Then, it tries to find the directory. If it can, it prints Found, otherwise it prints Not Found. (Note: when I run Python from the command line, it prints Found.)

However, when PHP opens up the command line and runs the Python script, it prints Not Found. I've tried authorizing it to use that location with the command above, I've tried using putenv to change the user running PHP, nothing works. Why can't Python find this location when called from PHP?

The site is hosted on a computer running Windows Server 2012, the remote location is running Windows Server 2008, PHP is v5.4, and IIS is IIS 8.5.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.