Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jonnybarnes's avatar

[Fixed] Symfony Process returns signal 9 inside api request

So if it matters, I’m trying to set up a web frontend for the youtube-dl command.

I want to check that youtube-dl can actually download a video before doing anything else. To do this I want to run the command with the --dump-json option, and check the exit code.

I’m doing this as part of an api request from clicking a download button.

The code to check the video can be downlaoded is as follows:

$mediaUrl = request()->input('url');
$process = new Process([
    config('app.youtubedl_cmd'),
    $mediaUrl,
    '--dump-json'
]);
$process->run();

Where Process is the Symfony Process class. I can run this inside artisan tinker and Tinkerwell absolutely fine. But ecerytime I run this from a controller action in response to a js fetch request I get a 500 response with the following error, with no delay:

Symfony\Component\Process\Exception\ProcessSignaledException: The process has been signaled with signal "9". in file /Users/jonny/git/youtube-dl-web/vendor/symfony/process/Process.php on line 424

Anyone know why the process will run fine in tinker, but fail as part of an actual web request?

On my dev setup, I was running php-fpm as the _www user. changing it to run as myself instead seems to have fixed things. So there must have been a permission issue.

0 likes
0 replies

Please or to participate in this conversation.