Run .sh file using exec Laravel PHP

后端 未结 3 1866
灰色年华
灰色年华 2021-01-14 20:15

I am trying to run a .sh file that will import a excel file to my database. Both files are in same directory inside the public folder. For some reason the exec command isn\'

3条回答
  •  时光说笑
    2021-01-14 20:32

    All of these answers are outdated now, instead use (Symfony 4.2 or higher):

    $process = Process::fromShellCommandline('/deploy.sh');
    

    Or

    $process = new Process(['/deploy.sh']);
    

    https://symfony.com/doc/current/components/process.html

提交回复
热议问题