Lesson 4: PHP vs Node.js
The everyday picture
PHP is like a taxi stand: every customer gets a fresh taxi, the ride ends, the taxi is gone. Node.js is like one very quick waiter who stays on shift all day, juggling every table at once.
What it really is
- Both run your code on the server and send pages or data back to the browser.
- PHP traditionally starts fresh for every visit: a request comes in, the script runs, sends the answer and finishes. Nothing is left running in between. This makes it simple to host, and almost every cheap shared hosting plan supports it. WordPress, which runs a large share of the web's websites, is built on PHP. Laravel is a popular modern PHP framework.
- Node.js is one program that keeps running all the time and handles every visitor inside it. That makes live features easy, like chat, notifications and live dashboards. But it needs a host that lets a program stay running, such as a VPS or a cloud platform, which many cheap shared plans don't offer.
What it means for your idea
If you want a content website, a blog or a shop that you or others edit, PHP with WordPress on cheap hosting may be the fastest, cheapest route. If you want a custom app with logins, dashboards and live features, and you're already learning JavaScript, Node.js keeps everything in one language.
Pick this when...
- PHP: WordPress, content sites, very cheap shared hosting, teams that already know PHP.
- Node.js: custom web apps, real-time features, one language for the screen and the server.
Quick check
You bought the cheapest shared hosting plan and your Node.js backend won't start. Why is that likely? Many shared plans only run PHP-style "start, answer, finish" code and don't let a program keep running.
Node.js is covered in Modules 41–46. PHP is not covered by the 100 modules.