1

I'm using process to run command in my code

$commandRaw = 'php artisan mytest:testCommand p1 p2 > /dev/null 2>&1 &';
$commands = explode(' ', $commandRaw);
$process = new Process($commands);
$process->run();
return $process->getOutput();

But when running, I was received error message

Could not open input file: artisan

My artisan path is D:/src/parent/laravel_api/artisan, so I tried to replace artisan in command by this path, but It didn't work

However, when I using cmd to run php D:/src/parent/laravel_api/artisan mytest:testCommand p1 p2 > /dev/null 2>&1 &, It worked

How can I define artisan path in code?

Spirit
  • 307
  • 1
  • 3
  • 13

1 Answers1

2

Could not open input file: artisan this error occur when you opened the cmd in parent directory you have to open the cmd where your actual project files are.This thing work for me.

shabi
  • 21
  • 2
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 01 '22 at 12:58