system("uptime");

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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

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.

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

Postby Redcircle » 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:

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

Or try: system("/usr/bin/uptime");

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

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

neither work.

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

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

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

Postby bonkers » 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:

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

safe_mode might set to ON. Ask the administrator for that.


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 5 guests