symfony-process

Symfony Process - Command not found

核能气质少年 提交于 2021-02-17 07:14:07
问题 I'm trying to execute ffmpeg commands using Symfony Process Component but command is not being processed. What am I doing wrong? I get the error The command "'ffmpeg -i [...........]' failed. Exit Code: 127(Command not found)" <?php $info = pathinfo($file); $dir = "{$info['dirname']}/{$info['filename']}"; File::makeDirectory($dir, 0755, true) $process = new Process(["ffmpeg -i {$info['basename']} -codec copy -map 0 -f segment -segment_list {$dir}/playlist.m3u8 -segment_list_flags +live

Symfony2 - process launching a symfony2 command

江枫思渺然 提交于 2020-01-21 18:46:31
问题 My goal is to launch some time consuming functions in the background to avoid user to wait before the server response is rendered. I have a Symfony project where I am launching an asynchronous process from a controller. This process will launch a Symfony command that will call another controller. The problem is when I am calling the process with start() $process = new Process('/usr/bin/php '.$this->get('kernel')->getRootDir().'/console scopusftpupload ' . escapeshellcmd($params)); $process-

Controlling an interactive process with PHP using Symfony Process

戏子无情 提交于 2019-12-21 13:26:48
问题 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 ssh-add process hangs on Enter passphrase for <path to key>: A simplified version of the code looks something like this use Symfony\Component\Process\Process; $keyPath = '<path to key>'; $keyPassword = '<password for unlocking the key>'; $socketPath

Run a detached endless job in Symfony

天大地大妈咪最大 提交于 2019-12-13 03:47:37
问题 Symfony: 4.1 PHP: 7.1 I have working websocket server using Ratchet. The websocket itself works fin. I can run it from the terminal using Symfony's commands php bin/console app:websocket:execute I'm having trouble getting around some of these issues: You need to dedicate a terminal to running this command Most webhosting services don't give you access to the terminal I want admins to be able to toggle the websocket server on and off Admins aren't required to know what a terminal is For issue

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

末鹿安然 提交于 2019-12-07 09:50:19
问题 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 this: http://symfony.com/doc/current/components/process.html#getting-real-time-process-output I can't figure out how to print in real time the terminal output in a Twig template. EDIT: Thanks to the Matteo's code and users comments, the final implementation is: /** * @Route("/genera-xxx-r", name="commission_generate_r_xxx") *

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

折月煮酒 提交于 2019-12-05 18:06:00
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 this: http://symfony.com/doc/current/components/process.html#getting-real-time-process-output I can't figure out how to print in real time the terminal output in a Twig template. EDIT: Thanks to the Matteo's code and users comments, the final implementation is: /** * @Route("/genera-xxx-r", name="commission_generate_r_xxx") * @Method({"GET"}) */ public function generateRXXXsAction() { //remove time constraints if your script last

Controlling an interactive process with PHP using Symfony Process

倖福魔咒の 提交于 2019-12-04 05:35:35
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 ssh-add process hangs on Enter passphrase for <path to key>: A simplified version of the code looks something like this use Symfony\Component\Process\Process; $keyPath = '<path to key>'; $keyPassword = '<password for unlocking the key>'; $socketPath = '<path to ssh-agent socket>'; $sshAdd = new Process( "ssh-add {$keyPath}", null, [ 'SSH_AUTH_SOCK'