Reputation: 79
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;
Upvotes: 2
Views: 946
Reputation: 48357
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.
Upvotes: 2
Reputation: 1
You need install the package first.
This package can be installed through Composer.
composer require symfony/process
Upvotes: -2