code: public static function uptime()
      {
          $uptime = -1;
          if(false !== ($data = @file("/proc/uptime"))){
              $data   = explode(' ',reset($data));
              $uptime = reset($data);
          }
          
          return floatval($uptime);
      }
docs: Server uptime
  @return float seconds