hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : system commands!
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

system commands!

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 08-25-2002, 07:00 AM
clocker1996 clocker1996 is offline
Disabled
 
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

Reply With Quote


Sponsored Links
  #2  
Old 08-25-2002, 07:55 AM
ffeingol ffeingol is offline
Community Guide
 
Join Date: Jun 2001
Location: Earth
Posts: 1,246
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

Reply With Quote
  #3  
Old 08-25-2002, 08:42 AM
AlCapone_yg AlCapone_yg is offline
Newbie
 
Join Date: Aug 2002
Posts: 11
Use passthru(), as exec() won't return all info.

__________________
It's kind of fun to do the impossible.

Reply With Quote
Sponsored Links
  #4  
Old 08-25-2002, 10:33 AM
combs combs is offline
Junior Guru
 
Join Date: Aug 2002
Location: Plymouth
Posts: 212
exec() will output your data in desired file

Reply With Quote
  #5  
Old 08-25-2002, 11:45 AM
Omair Haroon Omair Haroon is offline
Web Hosting Evangelist
 
Join Date: Feb 2001
Location: Pakistan Baby!
Posts: 455
Use backtick function in PHP. Here is a quote from the PHP Manual:

Quote:
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.

--Omair

__________________
36Host.com - reliable & affordable web hosting
* Providing Affordable Small Business Web Hosting since 2003! *


Reply With Quote
  #6  
Old 08-25-2002, 11:52 AM
clocker1996 clocker1996 is offline
Disabled
 
Join Date: Nov 2001
Location: Canada
Posts: 1,963
tthx

Reply With Quote
  #7  
Old 08-25-2002, 11:55 AM
Omair Haroon Omair Haroon is offline
Web 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! *


Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Nebula Launches All-in-One OpenStack Private Cloud System Web Hosting News 2013-04-02 11:18:17
.co.za Domain Price Hike Expected to Push Registrars, ISPs to Use EPP System Web Hosting News 2013-01-11 13:35:51
cPanel Security Updates Address Perl Module Vulnerabilities Web Hosting News 2012-12-06 12:55:54
SingleOS Launches Fuscan Linux Cloud 2.0 Web Hosting News 2011-08-12 19:09:05
FBI Scrubs 19,000 PCs Infected by Coreflood Bot Malware Web Hosting News 2011-06-23 15:32:40


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?