Choose by actual workload, deployment and team ownership. Node fits event-driven I/O when the loop stays unblocked; PHP fits request/response applications where its SAPI and team fit.
Node.js event-loop services compared with PHP request handling under a named SAPI, including state, CPU work and migration.
Node.js and PHP can both serve web workloads. The right choice depends on deployment mode, workload, existing code and team ownership.
Compare the practical consequences
Scroll sideways to compare all columns on a smaller screen.
Node.js and PHP by decision criterion
Criterion
Node.js
PHP
What changes the decision
Request scheduling
One JS event loop schedules callbacks; many I/O operations can be pending, but JS callbacks run to completion
Common FPM deployment assigns requests to worker processes; other SAPIs or long-running worker models differ
Compare the actual SAPI/process model and concurrency limits
Slow CPU callback
Blocks that event loop and delays unrelated callbacks in that process
Occupies the handling worker and reduces available worker capacity
CPU work needs a bounded queue/process/worker design in either stack
Long-lived connections
Event-driven APIs map naturally, subject to loop health and resource limits
Possible with suitable runtime/server architecture, but often requires changing a traditional short-request assumption
Prototype connection lifecycle, memory, restart and observability costs
Session/request state
Process memory is shared by requests and may disappear on restart or differ across replicas
PHP session APIs commonly load/save per request; default file handler can lock same-session concurrent requests
Both need explicit state ownership and safe concurrency semantics
I/O and streaming
Node stream APIs expose backpressure
PHP output/input behavior depends on buffering, SAPI, web server and libraries
Measure the whole path, not a language microbenchmark
Existing application
Reuse current modules, operational skills and deployment
Reuse current modules, operational skills and deployment
A rewrite pays integration, data migration and dual-running costs before any benefit
In Node, an asynchronous network call returns control to JavaScript while the operation is pending. When it completes, its callback or continuation gets scheduled. The event loop does not mean every operation is parallel; JavaScript callbacks on that loop execute one at a time. If one callback performs a long synchronous loop, other requests sharing the loop wait.
On Node, request A starts network I/O and returns to the loop; the continuation resumes when the operation completes, while callbacks from B can run in the meantime. In PHP-FPM, A occupies one worker while it waits; B can use another worker until the configured pool is busy, after which requests queue. This describes the common deployment models, not an intrinsic guarantee of either language.
text · Worked example
Node request A starts async I/O -> JS loop can run request B -> A continuation is scheduled
PHP-FPM request A occupies worker 1 -> request B can use worker 2 if one is available
The trace assumes A’s I/O is genuinely asynchronous in Node and that the PHP-FPM pool has at least two idle workers. If all PHP workers are occupied, B waits for capacity; if the Node callback does CPU-heavy synchronous work, B waits for that loop to become available.
Illustrative, not executed.
Follow-up: Which is faster under 500 concurrent requests?
This cannot be answered from the names. Measure the same application path, data, worker/connection limits, and latency/error distribution under the intended deployment.
Suppose image metadata parsing takes 500 ms of synchronous JavaScript. On a Node event loop, callbacks for other connections in that process cannot run during that work. Split CPU work into bounded chunks only when that is correct, or move it to a worker thread/process/queue. Worker threads can run CPU-intensive JavaScript separately; they are not the default tool for ordinary asynchronous I/O.
On PHP-FPM, the same CPU work occupies the worker serving that request. Other workers can proceed until the pool is saturated; then requests queue or fail according to the server configuration. A separate worker/queue can protect interactive requests here too. The scarce resource differs by configuration, but neither runtime removes the CPU cost.
Operational trace: if the feature is a request-triggered report, put a deadline on the request, bound the work, and return a job identifier only if the product can handle asynchronous completion. Measure queue depth and completion/failure state. Do not make a slow operation “async” merely by wrapping it in a promise or Fiber.
Follow-up: Do PHP Fibers make PHP non-blocking?
Fibers provide suspend/resume control flow. They do not automatically turn a blocking database or file call into non-blocking I/O; the library/runtime must integrate with the scheduling model.
Do not put authoritative session state in a Node process variable and assume the next request reaches the same process. A restart loses it, and multiple replicas do not share it. Choose a session store or signed client token according to the security and consistency model. In PHP, session_start() reads session state and the default file handler locks a session file while open. A second concurrent request with the same session can wait until the first closes it or ends; session_write_close() can release the lock after writes finish.
A concrete AJAX failure occurs when a page starts two slow same-session requests: one request opens the session, then waits on unrelated I/O; the other request waits for the file lock even if its own work is ready. Close the session early after required mutations, or use a backend with appropriate concurrency behavior. The remedy still depends on configured handler and application semantics.
Both runtimes need explicit ownership for authorization state, expiry, rotation and cross-replica consistency. Process memory, a framework session object and a durable shared store are not interchangeable.
Follow-up: Does PHP automatically make requests stateless?
No. The request lifetime is not the same as the application state policy. Sessions, database writes, caches and external services persist state by separate mechanisms.
Keep the runtime that meets the real workload and the team can operate. Consider a change only when a representative pilot proves an operational or maintenance mismatch.
New service with many concurrent long-lived I/O connections and a team that operates Node. Node can make the event-driven flow direct. Prototype connection cleanup, memory limits, deploy restart behavior and loop delay; one blocking dependency can undermine the model. Reverse toward PHP if the actual supported hosting can meet the connection lifecycle and the team has stronger PHP service experience.
CPU-heavy report generation invoked by web requests. Neither request worker should own unbounded work. Put a durable queue/worker boundary in the design and keep the HTTP layer responsive. The worker language can follow team and library needs. Reverse runtime choice only if the queue integration, deployment model or needed library is materially better in one ecosystem.
Small JSON endpoint next to an established PHP app. A separate Node service adds deployment, auth and on-call boundaries. Extend PHP if that meets needs. A split makes sense only when independent lifecycle or capability is valuable enough to own.
Follow-up: What measurement is worth running first?
One representative endpoint through the real database and serialization path under a load profile the product expects; record latency percentiles, errors, worker/connection saturation and CPU/memory. Keep request semantics identical.
Node's stream APIs coordinate producer/consumer flow. When a writable signals backpressure, a producer should stop writing until it can continue; ignoring that signal can buffer data faster than the destination consumes it. PHP response buffering and streaming depend on PHP, the SAPI, web server, reverse proxy and libraries. A flush() call alone does not prove bytes reached the client immediately.
For a large export, test a slow client, cancellation, memory usage, error after headers, and proxy buffering in the intended stack. A stream that keeps memory bounded can be more important than short handler syntax. If this is a normal small JSON response, streaming machinery may add needless complexity.
Follow-up: Can a benchmark on localhost settle backpressure?
No. Include the real network/proxy path and a slow consumer; localhost can hide buffering and connection behavior.
Migrate one boundary that can be deployed and observed independently. Keep one owner for authentication/session semantics and one source of truth for data. Define timeout/retry rules and correlation identifiers before splitting a request across runtimes. Avoid dual writes unless there is a reconciliation design; otherwise partial failure leaves two disagreeing records.
A PHP-to-Node migration can first expose a narrow read-only or idempotent operation, route a small class of requests to it, compare outputs, then move writes only when rollback and ownership are explicit. A Node-to-PHP change follows the same boundary discipline. If a feature cannot be split without copying session or database ownership, migration is likely a larger system redesign than a runtime substitution.
Follow-up: When is a rewrite justified?
When a named requirement has measurable cost in the existing system, a replacement proves the required behavior in the real operating environment, and the team has priced migration, dual-running and support. “Modernize” is not an acceptance criterion.
These are Hacker News job posts that mention these technologies, not employee earnings or a measure of what a skill adds to pay. The amounts summarize annualized advertised minimums in approximate USD. Groups can overlap and differ in roles, locations and dates.
Approximate USD using ECB daily reference rates as of 2026-10-30. Original currencies and offer ranges remain on the source listings. These figures cover posts tagged Node.js, rather than every job in the broader technology family.
PHP posts
25 posts · 25 usable advertised salary amounts
2024-07-08 to 2026-11-02
Not enough usable observations for an aggregate salary: at least 30 are needed. Individual source offers can still be useful.
Approximate USD using ECB daily reference rates as of 2026-10-30. Original currencies and offer ranges remain on the source listings. These figures cover posts tagged PHP, rather than every job in the broader technology family.
How many source posts appear in both salary groups?
Source posts can appear in both groups in this salary dataset. The same advertised salary can therefore contribute to both summaries.
Node.js posts in this dataset3 of 208 also tagged PHP · 1.4%
PHP posts in this dataset3 of 25 also tagged Node.js · 12.0%
What these bars count
Bars count distinct source posts with known HN IDs in these salary cohorts, not every Hacker News post or the wider job market. Duplicate IDs count once; rows without a valid HN ID are left out, so the bars cannot establish overlap for the full population. These are source-post counts, not the salary-observation counts in the cards above. A missing tag does not prove a technology was not used. Overlap does not establish employer preference, adoption or a pay effect.