Valhalla Legends Forums Archive | Web Development | How to open programs

AuthorMessageTime
Kaiory
Is it possible to open and or close a program through a certain weblanguage?
July 29, 2004, 4:54 AM
Maddox
system(), exec(), and passthru() in PHP, I'm not sure about other languages.
July 29, 2004, 5:03 AM
Kaiory
Thanks a lot maddox
July 29, 2004, 5:50 AM
MeltingWax
in perl its command();
August 8, 2004, 4:30 AM
St0rm.iD
I have a similar question to this...in PHP...how can you start a process with certain environment variables?
August 8, 2004, 3:49 PM
Adron
[quote author=$t0rm link=board=22;threadid=7949;start=0#msg74600 date=1091980148]
I have a similar question to this...in PHP...how can you start a process with certain environment variables?
[/quote]

A post on a page at the php site says:

[quote]
nehle at dragonball-se dot com
21-Oct-2003 11:59
Remember that some shell commands in *NIX needs you to set a TERM enviroment. For example:
<?php
exec('top n 1 b i', $top, $error );
echo nl2br(implode("\n",$top));
if ($error){
exec('/usr/bin/top n 1 b 2>&1', $error );
echo "Error: ";
exit($error[0]);
}
?>
This will echo "Error: TERM enviroment variable not set. " To fix it, add TERM=xterm (Or some other terminal) to the exec-statement, like this

<?php
exec('TERM=xterm /usr/bin/top n 1 b i', $top, $error );
echo nl2br(implode("\n",$top));
if ($error){
exec('TERM=xterm /usr/bin/top n 1 b 2>&1', $error );
echo "Error: ";
exit($error[0]);
}
?>
[/quote]
August 11, 2004, 3:10 PM

Search