PHP

PHP License 4 (BSD-3-Clause)
Platform
Linux Windows macOS
Licence
PHP License 4 (BSD-3-Clause) Open source
Website
php.net/
PHP

Overview

PHP (the recursive acronym for PHP: Hypertext Preprocessor) is a general-purpose scripting language built for the web. Rasmus Lerdorf released the first version as a set of CGI scripts in 1995; PHP 3 in 1998, rewritten by Andi Gutmans and Zeev Suraski, turned it into a full language, and PHP 8.0 in November 2020 added a JIT compiler, union types, attributes and the match expression. Code is written in plain files and executed by the interpreter on each request, so a page is a program that runs on the server and returns HTML — no separate build step, no framework required. PHP is free and open source under the PHP License, and it is the language behind WordPress, Drupal, Joomla, MediaWiki, Nextcloud and Matomo, which is why a working PHP install is almost always one package-manager command away.

Key Features

  • Runs directly in HTML — templates and logic share a file, so a page can start as a three-line script and grow into an application without a rewrite.
  • Composer and Packagist — dependency management with autoloading and a package index of several hundred thousand libraries, from HTTP clients to queue workers.
  • Strict typing when you want it — declare(strict_types=1), scalar and return type hints, union and intersection types, backed enums, readonly properties and constructor promotion.
  • JIT and OPcache — the opcode cache ships with the interpreter and the JIT compiler (PHP 8.0+) accelerates long-running CPU work.
  • Built-in development server — php -S localhost:8000 serves a project with no Apache or Nginx to configure.
  • Databases included — PDO plus native drivers for MySQL/MariaDB, PostgreSQL, SQLite, SQL Server and Oracle.
  • Deploys anywhere — PHP-FPM behind Nginx or Apache, mod_php, CGI, or the CLI for scripts and cron jobs; official Windows builds and packages in every major Linux distribution.
  • Mature tooling — Xdebug for step debugging and profiling, PHPUnit and Pest for tests, PHPStan and Psalm for static analysis, PHP-CS-Fixer for style.

Why Use PHP?

PHP is the pragmatic choice for server-rendered web software. Deployment is unglamorous and cheap: nearly every shared host and every Linux distribution ships it, request handling is a well-understood PHP-FPM pool, and the language has two decades of documentation, answers and libraries behind every common problem. The modern language is not the one its reputation was built on — enums, readonly classes, first-class callable syntax and a real type system arrived in 8.x, and the frameworks moved with them. Laravel and Symfony are mature, hiring is easy, and the ecosystem includes the most widely deployed publishing software in the world. When the job is a website, an admin panel, an internal tool or an API in front of a relational database, PHP gets there with fewer moving parts than most alternatives.

Use Cases

  • Content sites and blogs on WordPress, Drupal or Joomla.
  • Online stores and marketplaces with WooCommerce, PrestaShop or Sylius.
  • Web applications and REST APIs built on Laravel, Symfony or Slim.
  • Self-hosted web software such as Nextcloud, Matomo, Roundcube and MediaWiki.
  • CLI scripts, cron jobs and queue workers run through the PHP binary.
  • Server-side rendering and templating in front of an existing application.

Getting Started

Install the interpreter from your distribution (php-cli and php-fpm on Debian and Ubuntu, php on Fedora, brew install php on macOS, or the official Windows builds from windows.php.net), then check it with php -v. Write a file and run it with php script.php, or serve a directory during development with php -S localhost:8000. Add Composer for dependencies and PSR-4 autoloading, and follow the official manual at php.net for the language reference and function index. The current stable series is 8.5, with 8.4 and 8.3 still receiving security fixes; 8.6 is in release-candidate testing. PHP License 4 — the Modified BSD (BSD-3-Clause) licence — covers current releases, while 8.5 and earlier carry the OSI-approved PHP License 3.01.

Explore More Categories

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.