I have a Python (2.7) script that connects with SSH to a remote device and configures it. This script works fine when I run it.
I have a PHP page that executes other Python scripts and they are working fine too. Problem: SSH script does not work when I run it from PHP page (PHP pages and no problem with Python script)
To be more specific, use script (when PHP Is executed by) until it is the first SSH related code ( How can this happen, and can I do anything to do this work? For example, consider this simple code: open ("file.txt", "w") Fp.write ("text") import paramiko fp.write ("other text") fp.close () if executed by me, everything works fine PHP page - code only until "import parameters" is executed. both executed by me - Apart from this: I tried to try and use hold but nothing came of it. No exceptions have been thrown. My guess is that When Apache sets PHP, it is what PHP is as a "Apache" user (usually in I will try ... except for the parameter: of the script. import Paramiko ).
fp =
paramiko for Apache user in your PYTHONPATH environment variable is not.
Apache (or
httpd in Linux) ) calls the user in the group
www-data ). Occasionally this user will have different environment variables that are generally expected of users. Although it usually does not matter, sometimes it causes strange talk (and I can see it happening with pipes).
Try: Excluding exceptions as the paramiko e: # Login to your exception here Pass # I Keep it here so that the examples can be compiled. You should know if it is installed or not (and I suspect it is not), #Astrate
No comments:
Post a Comment