How do I change the shell for php's exec()

后端 未结 4 1709
名媛妹妹
名媛妹妹 2021-01-11 15:20

I want to use php\'s exec() function on an ubuntu server. The problem is, I alway get an error, that the command is not found. For example using

exec(\"echo         


        
4条回答
  •  孤独总比滥情好
    2021-01-11 15:36

    Try shell_exec() instead. exec should not invoke ANY shell to execute your program. Alternately, you can invoke bash with exec like

    exec("/bin/bash -c \"echo $foo > bar.txt'\"")
    

提交回复
热议问题