Here's an example code to get the system boot time in seconds using shell_exec()
in php:
main.php337 chars7 lines
In this code, we use the shell_exec()
function to execute a shell command (uptime -s
) that returns the last system start time as a string. We then convert this string to a timestamp using the strtotime()
function. Finally, we calculate the time difference between the current time and the system boot time, and print it to the console.
gistlibby LogSnag