user1584421
user1584421

Reputation: 3863

run external programs on virtual server

I want to install small programs accessible through the command line (of linux OS) to a server and run them with PHP. I want to install Apache, vhost on my machine... Is there a way to run these external applications on my virtual server, on my system, so i can experiment with PHP calls?

Upvotes: 2

Views: 610

Answers (2)

Krista K
Krista K

Reputation: 21871

We do exactly this all the time. I call them voodoo pages. Here's some working code:

<?php
$command="uptime"; $output; $retval; $errors="";
exec ( $command ,  &$output, &$retval  );
echo $output[0]."\n";
unset($output);
?>

And the output to the webpage served:

13:40:19 up 22 days, 23:14,  0 users,  load average: 0.04, 0.02, 0.00

Upvotes: 2

dash
dash

Reputation: 27

you could write some shell scripts *.sh and they will open the applications. you could use the php command "shell_exec" and run these shell scripts.

Upvotes: 1

Related Questions