PHP, Node.js or Go: which backend to choose

How PHP, Node.js and Go differ for the server side: thirteen criteria, which language for which project, how the difference shows in practice, one API written in all three and common mistakes.

Stack and technologies Updated

In short

PHP, Node.js and Go are the three most common choices for the server side of a web project, and each wins in its own place. PHP is the fastest way to a site, a shop or an admin panel: hosting everywhere, every request starts clean, a huge ecosystem. Node.js is the choice when the front end is in JavaScript or TypeScript and the server should share code and types with it, or when there is a lot of real time — chats, notifications, live data. Go is for services that must hold high load on modest hardware with stable response times: APIs, queues, gateways. Many projects use two of them side by side.

In short: which one to choose

Start from what the server mostly does. If it assembles pages, handles forms and serves an admin panel — that is PHP’s home: cheap to host, quick to build, easy to find developers for. If it holds thousands of open connections or shares logic with a React interface — Node.js. If it is an API under real load, a queue worker or a gateway that must answer in milliseconds on any traffic — Go.

The choice is not exclusive. A typical healthy setup: the site and admin panel in PHP, a high-load part in Go, and a build of the interface on Node.js and Vite. Each language does what it is best at.

  • Sites and admin panels — PHP
  • Real time and shared code — Node.js
  • Load and stable latency — Go

PHP, Node.js and Go: a detailed comparison

Thirteen criteria side by side. Speed depends on the code and the database, so the table shows relative positions rather than benchmarks.

CriterionPHPNode.jsGo
Request model each request starts clean one process, an event loop a goroutine per request
Typing dynamic + strict types by choice with TypeScript — static at build time static, checked by the compiler
Speed under load good with OPcache high on I/O the highest of the three
Memory per worker; many workers add up one process, moderate the most economical
Long connections with extra tools natively natively
Heavy computing weak blocks the loop, needs threads strong, uses every core
Hosting any, including shared VPS or platform VPS, one file
Deployment copy the files code plus node_modules, a process manager one binary, a process manager
Ready CMS and shops the most a few almost none
Shared code with the front end no yes, the same language no
Speed of development very high for sites high high once the base is written
Developers on the market very many very many fewer, but growing
Best for sites, shops, admin panels real time, APIs for React, bots high-load APIs, queues, gateways

Which language for which project

Twelve typical projects with a recommendation and the reason.

ProjectTakeWhy
Corporate site or landing page PHP cheap hosting, fast development
Online shop or catalogue PHP the classic task with the richest ecosystem
Admin panel or CRM PHP forms, tables and roles are its daily work
API for a React interface Node.js shared types and one language
Chat, notifications, live data Node.js or Go open connections are native to both
Telegram bot and Mini App Node.js or Go long-running processes and good libraries
Next.js site Node.js server rendering of React needs it
High-load API Go stable latency and little memory
Queue worker and integrations Go goroutines process thousands of tasks in parallel
Gateway or proxy Go a standard library made for networking
Imports and scheduled scripts any the one the project already uses
Shared hosting only PHP the others need a VPS

How the difference shows in a real project

  1. A memory leak

    In PHP it dies with the request; in Node.js and Go it grows until the process is restarted — needs monitoring.

  2. An unhandled error

    In PHP it breaks one request; in Node.js it can take down the whole process; in Go a panic in a handler is caught by the server.

  3. Ten calls to other APIs

    PHP makes them one after another unless you use curl_multi; Node.js and Go make them in parallel naturally.

  4. A traffic peak

    PHP needs enough workers and memory for them; Go absorbs the peak with goroutines; Node.js — while nothing blocks the loop.

  5. Updating the server

    PHP — copy files; Go — replace one binary and restart; Node.js — install dependencies and restart.

  6. Five years later

    Go and plain PHP code age slowly; a Node.js project with many dependencies needs regular updates.

One API in three languages

The same endpoint — a list of products filtered by price — in PHP, Node.js and Go. Each was run as a real server and gave the same answer.

PHP

A file that runs from scratch for every request — no server code to keep alive.

index.php
<?php
declare(strict_types=1);

// PHP: every request runs this file from scratch — no state to leak between requests
$products = [
    ['sku' => 'A-100', 'title' => 'Oak table', 'price' => 24000],
    ['sku' => 'B-200', 'title' => 'Pine shelf', 'price' => 5000],
];

if (parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) !== '/api/products') {
    http_response_code(404);
    exit;
}
$max = (int) ($_GET['max'] ?? PHP_INT_MAX);
header('Content-Type: application/json');
echo json_encode(
    array_values(array_filter($products, fn(array $p): bool => $p['price'] <= $max)),
    JSON_UNESCAPED_UNICODE,
);

Node.js

One long-lived process on built-in modules; the same language as the interface.

server.ts
import { createServer } from 'node:http';

// Node.js: one long-lived process; the event loop serves every request
const products = [
  { sku: 'A-100', title: 'Oak table', price: 24000 },
  { sku: 'B-200', title: 'Pine shelf', price: 5000 },
];

createServer((req, res) => {
  const url = new URL(req.url ?? '/', 'http://localhost');
  if (url.pathname !== '/api/products') {
    res.writeHead(404).end();
    return;
  }
  const max = Number(url.searchParams.get('max') ?? Infinity);
  res.writeHead(200, { 'content-type': 'application/json' });
  res.end(JSON.stringify(products.filter((p) => p.price <= max)));
}).listen(8082);

Go

Typed data and a route with the method in the pattern; the result is one binary.

main.go
package main

import (
	"encoding/json"
	"math"
	"net/http"
	"strconv"
)

type Product struct {
	SKU   string `json:"sku"`
	Title string `json:"title"`
	Price int    `json:"price"`
}

var products = []Product{
	{"A-100", "Oak table", 24000},
	{"B-200", "Pine shelf", 5000},
}

// Go: one compiled binary; each request is served in its own goroutine
func main() {
	http.HandleFunc("GET /api/products", func(w http.ResponseWriter, r *http.Request) {
		limit := math.MaxInt
		if v, err := strconv.Atoi(r.URL.Query().Get("max")); err == nil {
			limit = v
		}
		found := []Product{}
		for _, p := range products {
			if p.Price <= limit {
				found = append(found, p)
			}
		}
		w.Header().Set("Content-Type", "application/json")
		json.NewEncoder(w).Encode(found)
	})
	http.ListenAndServe(":8083", nil)
}

Common mistakes when choosing a backend

  1. Go for a landing page

    A compiled service and a VPS for a page with a form — more to run, nothing gained.

  2. PHP for thousands of WebSockets

    The request model does not fit long connections without extra tools.

  3. Node.js for heavy computing

    One long calculation stops every other request.

  4. Choosing by fashion

    The language should fit the task and the team, not the trends of the year.

  5. One language for everything

    A small Go service next to a PHP site often solves the load better than rewriting the site.

  6. Blaming the language for the database

    Most slow backends are slow because of queries and missing indexes, not the language.

Questions about PHP, Node.js and Go

What is the best language for a backend?

There is no single answer: PHP for sites and admin panels, Node.js for real time and shared code with the front end, Go for load.

Which is the fastest?

Go usually — but for a typical site the time goes to the database, and all three are fast enough.

Is PHP worse than Node.js?

No, it is different: PHP is simpler and cheaper for sites; Node.js is stronger in real time and shared code.

When to move from PHP to Go?

Not the whole project — only the part that does not cope with the load, as a separate service.

Can they be combined?

Yes, and it is common: a PHP site, a Go service for load, Node.js for building the front end.

What is cheaper to host?

PHP runs on any shared hosting; Go uses the least memory on a VPS; Node.js needs a VPS or a platform.

Which is easier to hire for?

PHP and Node.js — there are very many developers; Go — fewer, but they are usually strong backend engineers.

Online form

Choosing
the backend

I work with PHP, Node.js and Go and choose by the task: PHP for sites and admin panels, Go for services under load, Node.js where the front end and back end share code. Tell me about the project — I answer within one working day.

Or write to [email protected]