Questions tagged [proc-open]

158 questions
4
votes
6 answers

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

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…
Cameron
  • 641
  • 1
  • 7
  • 18
4
votes
4 answers

proc_open leaves zombie process

The following scripts monitors /dev/shm/test for new files and outputs info about it in real time. The problem is that when user closes the browser, a inotifywait process remains open, and so on. Is there any way to avoid this?
JorgeeFG
  • 5,651
  • 12
  • 59
  • 92
4
votes
1 answer

Multiple writes to a process opened with proc_open

So I open a process with $process = proc_open("my_process", $descriptors, $pipes); Then I write to the stdin of the process using fwrite($pipes[0], "some_command"); Then I have to close the pipe using fclose($pipes[0]); before i can read from the…
Jim_CS
  • 4,082
  • 13
  • 44
  • 80
3
votes
1 answer

load .profile with proc_open()

Here's the situation: I wrote a back end application, that runs on a certain server. On this server, there is a script that can be executed from the front end server, over ssh. My script will then check to see if the environment variables it needs…
Elias Van Ootegem
  • 74,482
  • 9
  • 111
  • 149
3
votes
1 answer

PHP Use proc_open and capture stdout of 'echo' command

I've been searching around but haven't managed to find a direct answer to this question. At the outset I'll state that what I'm trying to achieve isn't necessarily particularly useful but the aim is partly to understand how PHP interacts with other…
ec2011
  • 570
  • 6
  • 20
3
votes
1 answer

Refresh output of long process in PHP page

I have a "long" script I want to execute in a PHP page, and I want its output to be 'refreshed' as soon as the script outputs something. I've read plenty of solutions like questions 4706525, 9182094, 8882383, PHP Flush Manual but it's not working as…
user1381
  • 506
  • 1
  • 5
  • 19
3
votes
0 answers

Is it necessary to fclose pipes and proc_close processes

I am using a script to open (proc_open) from 5 to 50 processes one after another. Each of them does cURL and posts results to DB. I do not want to wait for their execution results, I just want them to run when the main script is axecuting and after…
Nikolay Antonov
  • 170
  • 1
  • 9
3
votes
1 answer

PHP proc_open bash vs dash

Consider this sample script: STDIN, 1 => STDOUT, 2 => STDERR), $pipes); fgetc(STDIN); When /bin/sh is symlinked to /bin/dash (the Debian default), cat gets executed in a shell: 30760 pts/0 …
Peter
  • 29,454
  • 5
  • 48
  • 60
3
votes
1 answer

Running java in PHP using proc_open() and getting the output

Help please. I can't figure out what the problem is with running java files thru proc_open(). It worked on C programs and I was able to get the output per line so I think nothing is wrong with fetching the output stream this way: $ctr =…
user2800050
  • 93
  • 11
3
votes
2 answers

PHP set proc_open to output directly to user

I'm using proc_open with pdftk to pre-fill some forms with data, this works pretty well, but rather than save the result to a file and then read the file back, I'd like to print the file directly out. I've got this working so I'm not having any…
kyall
  • 403
  • 1
  • 3
  • 11
2
votes
1 answer

how to handle infinite loop process when using proc_open

I use proc_open to execute a program created by c language. I was using file for the "stdout". $descriptorspec = array( 0 => array("pipe", "r"), 1 => array("file", "/tmp/example.output"), 2 => array("file", "/tmp/example.error",…
2
votes
0 answers

How do I use proc_open() with a non-standard file descriptor on Linux?

The proc_open() documentation states that it's possible to use other file descriptors than the standard ones: 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…
John Carter
  • 53,924
  • 26
  • 111
  • 144
2
votes
2 answers

PHP Show CMD Command Prompt Window (Windows)

Usually, you would want to hide the CMD window. In my case, I'll be doing some tests with PHP+CLI. It will be mighty useful if PHP could be made to launch a CLI popup. But alas, I can't find a way to make it to. The following command should have…
Christian
  • 27,509
  • 17
  • 111
  • 155
2
votes
3 answers

PHP Process Execution Timeout

I have the following code: /** * Executes a program and waits for it to finish, taking pipes into account. * @param string $cmd Command line to execute, including any arguments. * @param string $input Data for standard input. * @param integer…
Christian
  • 27,509
  • 17
  • 111
  • 155
2
votes
0 answers

How to configure proc_open "pipes" for ffmpeg stdin/stderr on Windows?

Firstly, I've spent the week googling and trying variations of dozens and dozens of answers for Unix, but it's been a complete bust, I need an answer for Windows, so this is not a duplicate question of the Unix equivalents. We're trying to create a…
GDP
  • 8,109
  • 6
  • 45
  • 82
1
2
3
10 11