What is PHP and where it runs

Contents
What is PHP
Where PHP runs
Why learn PHP 8.5
Check your setup

What is PHP

PHP is a server-side scripting language built for the web. A visitor requests a page, PHP code runs on the server, and the server sends back plain HTML.

Unlike scripts in the browser, PHP never runs on the visitor's computer in a normal setup. It runs where your site lives: on the server.

$message = "Hello from the server!"; echo $message;

Where PHP runs

The same language runs in three places. Behind a web server it builds pages and APIs. In the terminal it runs scripts, tests, and maintenance jobs.

On your own machine the built-in web server is enough for learning. You will meet it in the next lesson.

echo PHP_SAPI; // cli or fpm-fcgi echo PHP_VERSION; // for example 8.5.0

Why learn PHP 8.5

Modern PHP is strict, fast, and typed. Each PHP 8 release added real types, faster execution, and cleaner syntax, and the full story lives in PHP versions.

Millions of sites run on PHP, from small blogs to large shops, so the first job or freelance order is never far away. Hosting, frameworks, and packages are everywhere.

function total(float $price, int $qty): float { return $price * $qty; } var_dump(total(9.5, 4)); // float(38)

Check your setup

You need two things for the next lesson: PHP 8.1 or newer and a terminal. Any code editor works, even a plain one without plugins.

if (version_compare(PHP_VERSION, "8.1.0", ">=")) { echo "Ready for the course!"; }

Next: Install PHP 8.5 and run your first command

Article author: Arthur Isaev

Related articles
Development with PHP
PHP course: zero to hero in 50 lessons
What is PHP and where it runs
Install PHP 8.5 and run your first command
Your first PHP script
Comments in PHP
Variables and constants
Types in PHP
Strings in PHP
Numbers in PHP
Operators
if and else
switch and match
Ternary, null coalescing and nullsafe
Loops
Arrays
Associative arrays
Functions
Variable scope
include and require
Namespaces
Composer and autoloading
Everyday string functions
Dates and time
JSON in PHP
Reading and writing files
Errors: read, reproduce, fix
Classes and objects
Constructors and promotion
Inheritance
Interfaces and traits
Enums
Magic methods
Attributes
Exceptions
Strict types
Closures and arrow functions
Generators with yield
Forms: GET and POST
HTTP: headers and status codes
Cookies
Sessions
Login with sessions
JSON REST endpoint
Database with PDO
Uploads and .htaccess
Lint like a pro
Clean functions
Debugging
Modern PHP tour: 5 to 8.4
PHP 8.5 for busy developers
Hero roadmap: the whole course on one page
Install PHP 8.5 on Windows 11
Install PHP 8.5 on Ubuntu
Install PHP 8.5 on Rocky Linux
Install PHP 8.5 on macOS
Install PHP 8.5 on FreeBSD
PHP 8.5 in Docker
Banner image

Search this site

Channel @aofeed Chat @aofeedchat

Contacts and cooperation:
I recommend our hosting beget.ru
Write to info@urn.su if you:
1. Want to write an article for our site or translate an article into your native language.
2. Want to place thematically relevant ads on the site.
3. Ads on my site pass maximum censorship. If you see an ad block unsuitable for school-age children, shocking or misleading - please contact us by e-mail
4. Found a mistake, inaccuracy, bug, etc. on the site. ... .......
5. Articles can be shared on social media by clicking a network icon: