Valhalla Legends Archive

Programming => Web Development => Topic started by: Kaiory on July 28, 2004, 11:54 PM

Title: How to open programs
Post by: Kaiory on July 28, 2004, 11:54 PM
Is it possible to open and or close a program through a certain weblanguage?
Title: Re:How to open programs
Post by: Maddox on July 29, 2004, 12:03 AM
system(), exec(), and passthru() in PHP, I'm not sure about other languages.
Title: Re:How to open programs
Post by: Kaiory on July 29, 2004, 12:50 AM
Thanks a lot maddox
Title: Re:How to open programs
Post by: MeltingWax on August 07, 2004, 11:30 PM
in perl its command();
Title: Re:How to open programs
Post by: Banana fanna fo fanna on August 08, 2004, 10:49 AM
I have a similar question to this...in PHP...how can you start a process with certain environment variables?
Title: Re:How to open programs
Post by: Adron on August 11, 2004, 10:10 AM
Quote from: $t0rm on August 08, 2004, 10:49 AM
I have a similar question to this...in PHP...how can you start a process with certain environment variables?

A post (http://se.php.net/manual/en/function.exec.php) 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]);
}
?>