Running a Python script from PHP

后端 未结 9 2211
鱼传尺愫
鱼传尺愫 2020-11-22 00:57

I\'m trying to run a Python script from PHP using the following command:

exec(\'/usr/bin/python2.7 /srv/http/assets/py/switch.py arg1 arg2\');

H

9条回答
  •  没有蜡笔的小新
    2020-11-22 01:23

    Alejandro nailed it, adding clarification to the exception (Ubuntu or Debian) - I don't have the rep to add to the answer itself:

    sudoers file: sudo visudo

    exception added: www-data ALL=(ALL) NOPASSWD: ALL

提交回复
热议问题