PHP Basics · Lesson 1 of 6

Server-side: the half of the web you have not seen

Understand what runs on the server versus the browser, why PHP dominates that layer locally, and set up PHP on your own machine.

Data This lesson: 122KB

Everything in web-development-basics and javascript-basics runs in the BROWSER — code the visitor's machine executes. But when you log into a site, where is your password checked? When you order, where is the order saved? Not in the visitor's browser, obviously — in the SERVER: a program on the hosting machine that receives each request, runs code, talks to a database, and sends back the finished page or answer. That server-side layer is where accounts, payments, records and everything trustworthy lives, and PHP is a language built specifically for it.

The honest market case, because PHP has a reputation problem worth addressing head-on: social media calls it old; the market disagrees. WordPress is PHP, and runs roughly 40% of all websites — every WordPress theme tweak, plugin fix and customisation gig is PHP work. Laravel, PHP's modern framework, is a mainstream stack in Pakistani agencies and named in local job ads steadily. And the wordpress-basics course's business route — local sites plus maintenance — gets its ceiling raised enormously by actual PHP skill, because you stop being limited to what plugins allow. Fashion is a bad career guide; installed base is a good one.

Setup: install XAMPP (free, Windows-friendly) — it bundles the Apache web server, PHP and MySQL in one installer. Start Apache from the XAMPP control panel, put files in the htdocs folder, and open localhost/yourfile.php in a browser. Your first file, hello.php:

<?php

echo "Assalam o Alaikum from the server";

?>

The <?php ... ?> tags mark where PHP runs; echo outputs text into the page. The crucial mental model, worth staring at: this code ran ON YOUR MACHINE-AS-SERVER, and the browser received only its OUTPUT. View-source proves it — no PHP visible, just the text. That invisibility is the point: server code, and everything it knows (passwords, keys, records), never reaches the visitor. You now have both halves of the web on one laptop.

Try it yourself

Install XAMPP, start Apache, and create hello.php in htdocs with an echo of your own. Open it via localhost, then view-source and confirm the PHP itself is invisible — only output travels. Then break it on purpose (remove a semicolon) and read the error the page shows; PHP's errors name file and line, and reading them calmly is the skill.

Check what you learned

Create your free BvLogic ID to take the quiz and record your score.

Create your BvLogic ID
Continue to lesson 2 All lessons