dqq48152418 2015-03-17 16:56
浏览 83

我无法从php调用重定向python文件的输出

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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料