2

The following code gives me a 127 error code (command not found). I run the script within a PHP-FPM chroot.

I tried other commands, all give me the 127 error code. Any ideas why?

use Symfony\Component\Process\Exception\ProcessFailedException;
use Symfony\Component\Process\Process;

 $process = new Process(['ls', '-lsa']);
 $exitCode = $process->run();
 echo $exitCode;
1
  • 1
    What have you tried to debug the problem? Commented Jul 29, 2020 at 8:12

2 Answers 2

2

Because the PHP is not inheriting an environment, and more specifically a path. Try /bin/ls

That might not work either if php-fpm is running a chroot jail. Or on a MS-Windows machine.

Sign up to request clarification or add additional context in comments.

Comments

-2

You need install the package first.

This package can be installed through Composer.

composer require symfony/process

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.