问题描述:

I'm trying to execute a python file from php, in python file I have this:

import sys

from subprocess import PIPE, Popen

nom = sys.argv[1];

print nom

def cmdline(command):

process = Popen(

args=command,

stdout=PIPE,

shell=True

)

return process.communicate()[0]

cmdline("nmap x.x.x.x -oX sortida.xml")

When I execute python pythonfile.py works, creates the sortida.xml file, but when y call it from php don't create sortida.xml file, only shows me the print

PHP:

 system('python /var/www/core/un.py q');

Thanks in advance

相关阅读:
Top