frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Phptop: Simple PHP ressource profiler, safe and useful for production sites

https://github.com/bearstech/phptop
103•kadrek•6mo ago

Comments

127dot1•6mo ago
Is it compatible with nginx+php-fpm stack?
tarjei_huse•6mo ago
Looks likely. The server part of it is just a PHP-hook.
joshstrange•6mo ago
Yeah, from a brief glance at this, it just adds a file that runs on every request which logs out to the php error log and then there’s another script that can parse that error log.
zerodeux•6mo ago
Exactly.

I'm the author, it's funny this thing pops up now, it was written +15 years ago and is barely maintained (but AFAKI still works).

The metrics collected are close to those from PHP-FPM (CPU user/sys, clock time, peak memory) + the wpdb hook because I had to profile lots of WP.

The most interesting part is the 'phptop' tool itself which actually parse the logs and make some useful histograms.

Its main force I think it's that it's very lightweight (500 lines of Perl, fast and efficient regexes), works everywhere (very old Perl will do), and gives results instantly. My usecase used to be : apt install phptop, wait (at least) 1min for data collection, get useful histogram. It's also obviously very easy to uninstall.

It does pollute the error log, but it's the most simple and universal data sink I could think of, and well it's a hack in the end.

Patches still welcome anyway :).

rthnbgrredf•6mo ago
Yes, but php-fpm already has this kind of information for you: https://www.inanzzz.com/index.php/post/6cn7/formatting-php-f...

You can print the time, cpu and memory usage per request and build metrics based on these outputs. This can be done in any major cloud, with open source tooling and even with simple linux coretuils. One tool to visualize such metrics is Grafana.

zerodeux•6mo ago
It is compatible with Nginx+FPM. It won't use the PHP-FPM specific logs (and thus does not impose any specific value from you for the access.format PHP-FPM setting). But it has to figure out where your app's error log is.
basilgohar•6mo ago
This is interesting, but it seems it's more useful for WordPress sites with the specific WPDB logic they have.

It'd be more interesting if, instead, they could intercept PDO queries and add profiling to those, for example.

Still, free code is free code. I don't want to look down upon it, just that the utility for my case is limited.

zerodeux•6mo ago
The wpdb logic is an addon and only triggers if wpdb is found. Phptop might still be useful in the general case to quickly and cheaply find CPU hotspots.

Nowadays it would be necessary to also show the various Curl/API calls because they're so omnipresent and impactfull on PHP sites (as wait time and not CPU time)... But AFAIK it's pretty hard to intercept them in a generic way.

nchmy•6mo ago
Its not evident to me what this does... It says that it "prints per query and average metrics", but it seems to just output some extremely generic stats. Does "query" actually mean request here?

I see there's a wordpress-specific wpdb mechanism - though it just seems to report total time spent on queries, and the slowest query. Surely something like Query Monitor is a far better tool for that?

A tool that everyone should be aware of and using is php-spx - its absolutely glorious for performance profiling/investigation. xhgui is similar, but bulkier and (in my experience) less accurate/insightful.

https://github.com/NoiseByNorthwest/php-spx

BafS•6mo ago
I can't praise SPX enough, it has saved my ass multiple times. The UI is great too.
xd•6mo ago
From a quick skim of the repo it looks to be injecting phptop_hook.php into any call to a php file with auto_prepend_file in php.ini. phptop_hook.php generates some stats on how long it took the php file to process and stores this via error_log() which can then be queried with the perl script phptop.
zerodeux•6mo ago
Author here.

"Query" does mean "HTTP request" in the summary. It's reported as "Hits" in the stats. Sorry for the incoherent wording ...

The SQL/wpdb support was added afterwards, and it shows because data is only collected but not used/displayed in the histograms.

Phptop is wayyy simpler and not even comparable to SPX, but you can install it in a few sec, use it 5min, uninstall it, and solve lots of common perf problem. That was my use case (it'as ancient code and I barely use it nowadays).

nchmy•6mo ago
Thanks for the clarification!

What do you use now?

We built another object storage

https://fractalbits.com/blog/why-we-built-another-object-storage/
60•fractalbits•2h ago•11 comments

Java FFM zero-copy transport using io_uring

https://www.mvp.express/
26•mands•5d ago•6 comments

How exchanges turn order books into distributed logs

https://quant.engineering/exchange-order-book-distributed-logs.html
50•rundef•5d ago•17 comments

macOS 26.2 enables fast AI clusters with RDMA over Thunderbolt

https://developer.apple.com/documentation/macos-release-notes/macos-26_2-release-notes#RDMA-over-...
467•guiand•18h ago•237 comments

AI is bringing old nuclear plants out of retirement

https://www.wbur.org/hereandnow/2025/12/09/nuclear-power-ai
35•geox•2h ago•26 comments

Sick of smart TVs? Here are your best options

https://arstechnica.com/gadgets/2025/12/the-ars-technica-guide-to-dumb-tvs/
435•fleahunter•1d ago•363 comments

Photographer built a medium-format rangefinder, and so can you

https://petapixel.com/2025/12/06/this-photographer-built-an-awesome-medium-format-rangefinder-and...
78•shinryuu•6d ago•10 comments

Apple has locked my Apple ID, and I have no recourse. A plea for help

https://hey.paris/posts/appleid/
873•parisidau•10h ago•450 comments

GNU Unifont

https://unifoundry.com/unifont/index.html
288•remywang•18h ago•68 comments

A 'toaster with a lens': The story behind the first handheld digital camera

https://www.bbc.com/future/article/20251205-how-the-handheld-digital-camera-was-born
42•selvan•5d ago•18 comments

Beautiful Abelian Sandpiles

https://eavan.blog/posts/beautiful-sandpiles.html
84•eavan0•3d ago•16 comments

Rats Play DOOM

https://ratsplaydoom.com/
335•ano-ther•18h ago•123 comments

Show HN: Tiny VM sandbox in C with apps in Rust, C and Zig

https://github.com/ringtailsoftware/uvm32
167•trj•17h ago•11 comments

OpenAI are quietly adopting skills, now available in ChatGPT and Codex CLI

https://simonwillison.net/2025/Dec/12/openai-skills/
481•simonw•15h ago•272 comments

Computer Animator and Amiga fanatic Dick Van Dyke turns 100

110•ggm•6h ago•23 comments

Will West Coast Jazz Get Some Respect?

https://www.honest-broker.com/p/will-west-coast-jazz-finally-get
10•paulpauper•6d ago•2 comments

Formula One Handovers and Handovers From Surgery to Intensive Care (2008) [pdf]

https://gwern.net/doc/technology/2008-sower.pdf
82•bookofjoe•6d ago•33 comments

Show HN: I made a spreadsheet where formulas also update backwards

https://victorpoughon.github.io/bidicalc/
179•fouronnes3•1d ago•85 comments

Freeing a Xiaomi humidifier from the cloud

https://0l.de/blog/2025/11/xiaomi-humidifier/
126•stv0g•1d ago•51 comments

Obscuring P2P Nodes with Dandelion

https://www.johndcook.com/blog/2025/12/08/dandelion/
57•ColinWright•4d ago•1 comments

Go is portable, until it isn't

https://simpleobservability.com/blog/go-portable-until-isnt
120•khazit•6d ago•101 comments

Ensuring a National Policy Framework for Artificial Intelligence

https://www.whitehouse.gov/presidential-actions/2025/12/eliminating-state-law-obstruction-of-nati...
169•andsoitis•1d ago•217 comments

Poor Johnny still won't encrypt

https://bfswa.substack.com/p/poor-johnny-still-wont-encrypt
52•zdw•10h ago•66 comments

YouTube's CEO limits his kids' social media use – other tech bosses do the same

https://www.cnbc.com/2025/12/13/youtubes-ceo-is-latest-tech-boss-limiting-his-kids-social-media-u...
86•pseudolus•3h ago•67 comments

Slax: Live Pocket Linux

https://www.slax.org/
41•Ulf950•5d ago•5 comments

50 years of proof assistants

https://lawrencecpaulson.github.io//2025/12/05/History_of_Proof_Assistants.html
107•baruchel•15h ago•17 comments

Gild Just One Lily

https://www.smashingmagazine.com/2025/04/gild-just-one-lily/
29•serialx•5d ago•5 comments

Capsudo: Rethinking sudo with object capabilities

https://ariadne.space/2025/12/12/rethinking-sudo-with-object-capabilities.html
75•fanf2•17h ago•44 comments

Google removes Sci-Hub domains from U.S. search results due to dated court order

https://torrentfreak.com/google-removes-sci-hub-domains-from-u-s-search-results-due-to-dated-cour...
193•t-3•11h ago•35 comments

String theory inspires a brilliant, baffling new math proof

https://www.quantamagazine.org/string-theory-inspires-a-brilliant-baffling-new-math-proof-20251212/
167•ArmageddonIt•22h ago•154 comments