system("uptime");

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
bonkers
New php-forum User
New php-forum User
Posts: 45
Joined: Wed Mar 12, 2003 7:17 pm

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.

User avatar
Redcircle
Moderator
Moderator
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Mon Jun 02, 2003 12:19 am

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

try using

passthru("uptime");

User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Mon Jun 02, 2003 4:38 pm

Or try: system("/usr/bin/uptime");
11:16am up 404 days, 2 users, load average: 148.68, 143.45, 132.6


Mike Vassileiou
[Systems Administrator / PHP Developer]


PHP/MySQL Manual:
http://www.phpmysql-manual.com

bonkers
New php-forum User
New php-forum User
Posts: 45
Joined: Wed Mar 12, 2003 7:17 pm

Mon Jun 02, 2003 5:24 pm

neither work.

User avatar
Redcircle
Moderator
Moderator
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

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

bonkers
New php-forum User
New php-forum User
Posts: 45
Joined: Wed Mar 12, 2003 7:17 pm

Mon Jun 02, 2003 9:15 pm

uptime works on my server, I'll try the echo thing.

User avatar
mike
New php-forum User
New php-forum User
Posts: 73
Joined: Sun May 04, 2003 4:26 am
Location: Athens
Contact:

Tue Jun 03, 2003 3:07 am

safe_mode might set to ON. Ask the administrator for that.
11:16am up 404 days, 2 users, load average: 148.68, 143.45, 132.6


Mike Vassileiou
[Systems Administrator / PHP Developer]


PHP/MySQL Manual:
http://www.phpmysql-manual.com

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests