Jump to content


Calling external program on Windows

  • Please log in to reply
No replies to this topic

#1 ct_guy

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 28 October 2006 - 08:20 PM

Hi, I have what I belive to be a fairly easy question, but the problem here is escaping me.  I am trying to call an external program using PHP and I want to read data out of that program and also send data to it.  It seems that using proc_open() is the obvious choice here, but I can't seem to read anything from the streams, or even tell if the program is running.  I get a command window opening up, but it just hangs until I kill the window.  I'm trying to automate the processing of a bunch of DNA sequences using a freeware program called rnafold that's available at http://www.tbi.univi...c.at/~ivo/RNA/  There is a windows binary available, and I was hoping to use this as I don't have a Linux system that I can easily work on.  If anyone is up for a little challenge, and can get php to communicate with the windows rnafold executable I would be greatly appreciative.

My attempt so far has been:

$specs = array(
0 => array("pipe","r"), //stdin
1 => array("pipe", "w"), //stdout
2 => array("pipe", "w") //stderr

$command = "C:\\RNAfold.exe -C";

$handles = array();
$process = proc_open($command,$specs, $handles);

$buffer = fgets($handles[1], 1024); //just trying to read the response from the program


This code looks like it successfully calls the rnafold program, but it just hangs at that point.  I don't see the output of the program echoed back to me, and I can't seem to send any commands to the program via fwrite();

Any suggestions, or am I missing something obvious?

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users