Menu

📰
0

statgrab 2.2: cross-platform system stats for PHP, picking up the 2005 PECL extension

Reddit r/PHP·u/Ilia0001·about 1 month ago
#qyOZ44vL
Reading 0:00
15s threshold

statgrab 2.2: cross-platform system stats for PHP, picking up the 2005 PECL extension A while back I pushed a small PECL extension that wrapped libstatgrab and exposed CPU, memory, disk I/O, network, and process statistics to PHP. It sat untouched for most of the PHP 5/7 era and stopped building cleanly on PHP 8 a few years back. I shipped 2.2 today, a full modernization of the binding for PHP 8.0 through 8.5 against libstatgrab 0.92+. The reason to revive it: nothing on the PHP side has replaced it. If you need system stats from PHP, you are typically choosing between three options. - Shell out to `w`, `vmstat`, `df`, `ps`. The output format drifts between OS releases, and you end up writing a per-tool parser. - Parse `/proc` by hand. Linux-only, every file (`meminfo`, `loadavg`, `diskstats`, `net/dev`) has its own format and edge cases. - Run a separate stats daemon and hit it over a socket. Adds a daemon to deploy and keep running.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More