Questions tagged [symfony-process]

Symfony Process component executes commands in sub-processes.

Symfony Process is one of the Symfony components that is bundled with Symfony but can also be used separately.

It allows to run sub-processes, view real-time process output, run them asynchronously, kill them with nice API.
Also it can be used to run PHP code in isolation.

Documentation:
http://symfony.com/doc/current/components/process.html

Install using Composer:
composer require symfony/process

Homepage:
https://github.com/symfony/process

102 questions
16
votes
4 answers

The lock file is not up to date with the latest changes in composer.json

I'm trying to clone a github repository and issue a composer install on it. But I am getting this: Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update…
user6313136
  • 275
  • 1
  • 3
  • 10
12
votes
3 answers

Run an asynchronous PHP task using Symfony Process

For time-consuming tasks (email sending, image manipulation… you get the point), I want to run asynchronous PHP tasks. It is quite easy on Linux, but I'm looking for a method that works on Windows too. I want it to be simple, as it should be. No…
Gras Double
  • 15,901
  • 8
  • 56
  • 54
7
votes
3 answers

How to run vi from Symfony Process?

I have the following code: $process = new Process('vi'); try { $process->setPty(true); $process->mustRun(function ($type, $buffer) { echo $buffer; }); //echo…
Denis V
  • 3,290
  • 1
  • 28
  • 40
7
votes
1 answer

Controlling an interactive process with PHP using Symfony Process

I am trying to control the systems ssh-agent by adding new keys to it using ssh-add. For this I'm using the Symfony Process component. When I run this code from a web site it works perfectly fine but when I run the same code in a shell/console the…
codeaken
  • 844
  • 1
  • 8
  • 20
6
votes
0 answers

Symfony Process component returns exit code -1

I am getting exit code -1 from the Symfony process command on some machines, while exactly the same code returns exit code 0 as excepted on others. In both cases the given command is executed successfully regarding its output. Running the same…
Bret R. Zaun
  • 103
  • 1
  • 6
5
votes
3 answers

Symfony2 run console command in background

I've created a console command for my symfony2 project and I want to execute it from a controller without blocking the controller output (in background). Normally is executed like this: $application = new…
Ceparu Stefan
  • 327
  • 2
  • 4
  • 13
5
votes
2 answers

symfony/process - Process silently not starting

In a fresh symfony2-project (installation as described here), I would like to start a console-process as part of a request. The app runs on a "standard" ubuntu 14.04 box with nginx + php-fpm. Consider this controller-code:
Jojo
  • 2,720
  • 1
  • 17
  • 24
4
votes
1 answer

Symfony: Redirect output of a Process

I am upgrading an old Symfony application (v2.8) to Symfony 5.3. I am using the process component where the arguments have to be passed in another way than before. My previous code was like use Symfony\Component\Process\Process; $cmd =…
stollr
  • 6,534
  • 4
  • 43
  • 59
4
votes
1 answer

How to access process object from various controllers

I'm starting a simple process via the Symfony Process component. /** * @Route("/start_process", name="startProcess") */ public function startProcessAction(Request $siteName) { $process = new Process('"C:\Program Files…
Stuffy
  • 302
  • 3
  • 15
4
votes
1 answer

Libreoffice headless Process result is not returned, but waits for timeout

We are using libreoffice --headless for a while now, first via Debian and over the last months we switched to CentOS. We are using the Symfony Process command to convert a docx to pdf, the simplified command looks like: libreoffice --headless…
Rvanlaak
  • 2,971
  • 20
  • 40
4
votes
0 answers

Symfony Process component dies once the request finishes

This function imports contacts. I would like to launch one process for merging the contacts in background. I'm using the Process class. However, It is not working successfully because when the request returns the response to the client, it kills the…
4
votes
1 answer

How to execute a command within a controller of a Symfony2 application and print in real-time the output in a Twig template

I need to execute a long-lasting command within a controller of my Symfony2 application and to return to the user in real time the output of the terminal. I have read…
Gianluca78
  • 794
  • 1
  • 9
  • 24
3
votes
1 answer

Laravel Job throwing Symfony\Component\Process\Exception\ProcessTimedOutException

I have web application that runs a job to convert videos into HLS using the aminyazdanpanah/php-ffmpeg-video-streaming package. However, after about 2 minutes, the job fails and throws the…
Fanan Dala
  • 584
  • 6
  • 19
3
votes
0 answers

How to pass a command line to Symfony Process component

I've tried to pass the following command line to Symfony Process component according to Symfony documentation: use Symfony\Component\Process\Exception\ProcessFailedException; use Symfony\Component\Process\Process; $process = new Process(['cat…
Abdel_91
  • 59
  • 5
3
votes
2 answers

How to launch a Symfony Command asynchronously during a request using the Symfony Process component?

I'm trying to execute a Symfony Command using the Symfony Process component so it executes asynchronously when getting an API request. When I do so I get the error message that Code: 127(Command not found), but when I run it manually from my console…
Calamity Jane
  • 2,189
  • 5
  • 36
  • 68
1
2 3 4 5 6 7