Click to See Complete Forum and Search --> : calling php script from perl


sjhonny
03-15-2005, 02:20 PM
hi,
i'm not sure whether this is the right forum for my question, but as i suspect my problem concerns the enviornment in which my php program is running, i decided to post it here:
i'm trying to call a php command-line program from a perl script (like so:
open (PIPE,"/path/to/my_program.php $arg1 $arg2 |");
)
when i run this perl program myself, it works fine. however, when i call it
from within another program, i get only the HTML header (content type: ....).
(of course, the first line in my_program.php contains the -q option, and it works perfectly when i call it myself)
i've experimented a bit, and found that the same output is produced even if i replace the previous command with this one:
open (PIPE,"/usr/local/php5/bin/php -v |");
anybody got any clue?
thanks,
Jhonny

lth2h
04-05-2005, 06:20 PM
I'm not sure but I think this is a perl question. Check out www.perlmonks.org

I think you should be using "exec" or "system" to run the php script instead of "open"

planetsim
04-05-2005, 09:31 PM
Im pretty certain you cant do Commands within Perls open function, you'll need to use a System/Execution function such as already suggested or even just using Perls quick easy way


`/path/to/my_program.php $arg1 $arg2 |`