Results 1 to 7 of 7
Thread: system commands!
-
08-25-2002, 07:00 AM #1Disabled
- Join Date
- Nov 2001
- Location
- Canada
- Posts
- 1,963
system commands!
Hi,
this is piss easy
does anyone know how you would run a system command and output it on the .php file ?
e.g. if i wanted to run 'w' how would i do that?
here is an example in perl
http://drirc.net/monitor/sys.pl
this would be for linux
-
08-25-2002, 07:55 AM #2Web Hosting Master
- Join Date
- Jun 2001
- Location
- Earth
- Posts
- 1,259
There are a bunch you could use. Check them out here at www.php.net. exec and system are the two that come to mind right away.
Frank█ Umbra Hosting
█ cPanel | Softaculous | CloudLinux | R1Soft | Ksplice
█ Web Hosting, Reseller Hosting, VPS, Dedicated Servers, Colocation
█ UmbraHosting.com
-
08-25-2002, 08:42 AM #3Newbie
- Join Date
- Aug 2002
- Posts
- 11
Use passthru(), as exec() won't return all info.
It's kind of fun to do the impossible.
-
08-25-2002, 10:33 AM #4Junior Guru
- Join Date
- Aug 2002
- Location
- Plymouth
- Posts
- 212
exec() will output your data in desired file
-
08-25-2002, 11:45 AM #5Web Hosting Evangelist
- Join Date
- Feb 2001
- Location
- Pakistan Baby!
- Posts
- 455
Use backtick function in PHP. Here is a quote from the PHP Manual:
PHP supports one execution operator: backticks (``). Note that these are not single-quotes! PHP will attempt to execute the contents of the backticks as a shell command; the output will be returned (i.e., it won't simply be dumped to output; it can be assigned to a variable).
$output = `ls -al`;
echo "<pre>$output</pre>";
Drop me a PM if you need any help regarding this or any other function.
--Omair36Host.com - reliable & affordable web hosting
* Providing Affordable Small Business Web Hosting since 2003! *
-
08-25-2002, 11:52 AM #6Disabled
- Join Date
- Nov 2001
- Location
- Canada
- Posts
- 1,963
tthx
-
08-25-2002, 11:55 AM #7Web Hosting Evangelist
- Join Date
- Feb 2001
- Location
- Pakistan Baby!
- Posts
- 455
No Problem
36Host.com - reliable & affordable web hosting
* Providing Affordable Small Business Web Hosting since 2003! *