Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

system("uptime");

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

system("uptime");

Postby bonkers » Sun Jun 01, 2003 10:16 pm

how can I get:

system("uptime");

to display the uptime of my linux box? It should work but of course, since it's me, it doesn't.
bonkers
New php-forum User
New php-forum User
 
Posts: 46
Joined: Wed Mar 12, 2003 7:17 pm

Postby Redcircle » Mon Jun 02, 2003 12:19 am

system() will not output anything back to the screen.

try using

passthru("uptime");
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby mike » Mon Jun 02, 2003 4:38 pm

Or try: system("/usr/bin/uptime");
User avatar
mike
New php-forum User
New php-forum User
 
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens

Postby bonkers » Mon Jun 02, 2003 5:24 pm

neither work.
bonkers
New php-forum User
New php-forum User
 
Posts: 46
Joined: Wed Mar 12, 2003 7:17 pm

Postby Redcircle » Mon Jun 02, 2003 6:41 pm

your server may have those commands turned off.

try
echo `uptime`;

those are not single quotes they are backticks same key as the ~

system() does not product any output it just runs the command and with an optional parameter will produce an interger error code
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby bonkers » Mon Jun 02, 2003 9:15 pm

uptime works on my server, I'll try the echo thing.
bonkers
New php-forum User
New php-forum User
 
Posts: 46
Joined: Wed Mar 12, 2003 7:17 pm

Postby mike » Tue Jun 03, 2003 3:07 am

safe_mode might set to ON. Ask the administrator for that.
User avatar
mike
New php-forum User
New php-forum User
 
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.