Trying to execute python command through php but permission errors

后端 未结 1 1104
梦毁少年i
梦毁少年i 2021-01-24 20:13

I uploaded an image file and copied it from temporary folder to a folder inside /var/www/. Then, tried to execute a python command via php where the exec() command is i

相关标签:
1条回答
  • 2021-01-24 20:42

    In the python script file, the directory change was done as

    os.chdir('/var/www/upload')
    

    and in the php side, I gave the full path for the python script to run

    exec('python /var/www/upload/script.py ' . $_FILES["file"]["name"]);
    

    This way, the problem got solved.

    0 讨论(0)
提交回复
热议问题