ct_guy Posted October 28, 2006 Share Posted October 28, 2006 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.univie.ac.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:<?php$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 programecho($buffer);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? Link to comment https://forums.phpfreaks.com/topic/25427-calling-external-program-on-windows/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.