proc-open

PHP: trying to get fgets() to trigger both on CRLF, CR and LF

狂风中的少年 提交于 2021-02-07 16:25:50
问题 I'm reading streams in PHP, using proc_open and fgets($stdout), trying to get every line as it comes in. Many linux programs (package managers, wget, rsync) just use a CR (carriage return) character for lines which periodically updates "in place", like download progress. I'd like to catch these updates (as separate lines) as soon as they happen. At the moment, fgets($stdout) just keeps reading until a LF, so when progress is going very slowly (big file for example) it just keeps on reading

How can I use PHP to setup an interactive SSH session?

巧了我就是萌 提交于 2021-02-07 08:37:45
问题 I'm trying to establish an interactive SSH connection to a remote server using PHP via the command line on Mac OS X 10.6. I'm currently using PHP's proc_open function to execute the following command: ssh -t -t -p 22 user@server.com This almost works. The -t -t options are supposed to force a pseudo terminal which they almost do. I am able to enter the SSH password and press enter. However, after pressing enter the terminal appears to simply hang. No output, no nothing - it's as if the SSH

Proc_open and Capifony issue

拟墨画扇 提交于 2020-01-25 23:45:57
问题 I'm trying to use Capifony with my web app in Symfony2.1 to accelerate the deployment process. Here is my deploy.rb file : default_run_options[:pty] = true set :application, "mywebsite" set :domain, "mywebsite.com" set :deploy_to, "~/git/mywebsite.git" set :app_path, "app" set :repository, "git@github.com:myname/mywebsite.git" set :scm, :git # Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, or `none` set :user, "myserveruser" # The server's user for deploys set

Proc_open and Capifony issue

╄→尐↘猪︶ㄣ 提交于 2020-01-25 23:40:33
问题 I'm trying to use Capifony with my web app in Symfony2.1 to accelerate the deployment process. Here is my deploy.rb file : default_run_options[:pty] = true set :application, "mywebsite" set :domain, "mywebsite.com" set :deploy_to, "~/git/mywebsite.git" set :app_path, "app" set :repository, "git@github.com:myname/mywebsite.git" set :scm, :git # Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, or `none` set :user, "myserveruser" # The server's user for deploys set

Proc_open and Capifony issue

那年仲夏 提交于 2020-01-25 23:40:07
问题 I'm trying to use Capifony with my web app in Symfony2.1 to accelerate the deployment process. Here is my deploy.rb file : default_run_options[:pty] = true set :application, "mywebsite" set :domain, "mywebsite.com" set :deploy_to, "~/git/mywebsite.git" set :app_path, "app" set :repository, "git@github.com:myname/mywebsite.git" set :scm, :git # Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, or `none` set :user, "myserveruser" # The server's user for deploys set

PHP - Kill proc_open() process on different file?

自闭症网瘾萝莉.ら 提交于 2020-01-04 09:19:18
问题 I am creating a background process using proc_open() and am wondering how to cancel or stop this background process, from a different file or action, while my background process is still running? Here is my code : $errorLog = './error.log'; $descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("file", $errorLog, "a") // stderr is a file to write to ); proc_open("

PHP - Kill proc_open() process on different file?

谁都会走 提交于 2020-01-04 09:19:07
问题 I am creating a background process using proc_open() and am wondering how to cancel or stop this background process, from a different file or action, while my background process is still running? Here is my code : $errorLog = './error.log'; $descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to 2 => array("file", $errorLog, "a") // stderr is a file to write to ); proc_open("

proc_open: Extending file descriptor numbers to enable “status” feedback from a Perl script

ε祈祈猫儿з 提交于 2020-01-03 10:45:03
问题 PHP's proc_open manual states: The file descriptor numbers are not limited to 0, 1 and 2 - you may specify any valid file descriptor number and it will be passed to the child process. This allows your script to interoperate with other scripts that run as "co-processes". In particular, this is useful for passing passphrases to programs like PGP, GPG and openssl in a more secure manner. It is also useful for reading status information provided by those programs on auxiliary file descriptors.

proc_open: Extending file descriptor numbers to enable “status” feedback from a Perl script

南楼画角 提交于 2020-01-03 10:44:14
问题 PHP's proc_open manual states: The file descriptor numbers are not limited to 0, 1 and 2 - you may specify any valid file descriptor number and it will be passed to the child process. This allows your script to interoperate with other scripts that run as "co-processes". In particular, this is useful for passing passphrases to programs like PGP, GPG and openssl in a more secure manner. It is also useful for reading status information provided by those programs on auxiliary file descriptors.

how to get output of proc_open()

二次信任 提交于 2019-12-30 04:24:26
问题 I've tried to get output from proc_open method in php, but, when I print it, I got empty. $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("file", "files/temp/error-output.txt", "a") ); $process = proc_open("time ./a a.out", $descriptorspec, $pipes, $cwd); as long as I know, I can get the output with stream_get_contents() echo stream_get_contents($pipes[1]); fclose($pipes[1]); But I can't do that.. any suggestion? Thx before... 回答1: Your code more or less