0

I use Symfony/process/process library in Yii2 for background process.

  $process = new Process(['yii','test/action']);
    $process->run();

It work fine in localhost but it does not work in server.

{name: "Exception",…} code: 0 file: "xxx\vendor\symfony\process\Process.php" line: 144 message: "The Process class relies on proc_open, which is not available on your PHP installation." name: "Exception" stack-trace: [,...] type: "Symfony\Component\Process\Exception\LogicException"

help me to solve this problem.

gp_sflover
  • 3,460
  • 5
  • 38
  • 48
  • 1
    It looks like your server is configured to disable `proc_open` function. If you can edit the `php.ini` file try checking the `disable_functions` directive and remove `proc_open` from there. Warning: this function is probably disabled for security reasons. If you remove it from `disable_functions` you will allow php scripts to run other applications. – Michal Hynčica Oct 28 '21 at 12:33

1 Answers1

0

Try this:

$process = new Process([
    Yii::getAlias('@app/yii'),
    'test/action'
]);
$process->run();
vvvvv
  • 25,404
  • 19
  • 49
  • 81
Ivošš
  • 1,106
  • 12
  • 18