What PHP Does
- Server-side scripting — embedded in HTML or standalone
- CLI execution — scripts, CLIs, cron jobs
- Built-in web server —
php -Sfor dev - Huge standard library — strings, arrays, HTTP, crypto, DB, JSON
- Frameworks — Laravel, Symfony, CodeIgniter, Phalcon, Yii
- CMS — WordPress, Drupal, Joomla, Magento
- ORM — Eloquent (Laravel), Doctrine (Symfony)
- Composer — Packagist is the largest PHP package registry
- JIT compiler — OPcache + JIT in PHP 8.0+
- Modern syntax — union types, enums, readonly, attributes, first-class callable
Architecture
Zend Engine interprets PHP bytecode. OPcache caches compiled bytecode between requests. PHP-FPM process manager serves requests behind Nginx or Apache. PHP 8 added a JIT tracing optimizer on top of OPcache for CPU-bound workloads.
Self-Hosting
# Production stack
# PHP-FPM + Nginx
apt install php8.3-fpm nginx
systemctl enable php8.3-fpm nginxKey Features
- Embedded in HTML or standalone
- JIT compiler (8.0+)
- Union and intersection types
- Enums (8.1+)
- Readonly properties (8.1+) and readonly classes (8.2+)
- Attributes (metadata annotations)
- First-class callable syntax
- Composer package ecosystem
- Laravel and Symfony frameworks
- WordPress and many CMS
Comparison
| Language | Use | Startup | Ecosystem |
|---|---|---|---|
| PHP | Web, CLI | Per-request | Huge (CMS) |
| Python | Web, ML, scripts | Per-request (uvicorn) | Huge |
| Ruby | Web, scripts | Per-request (Rails) | Large |
| Node.js | Web, CLI | Long-running | Huge |
| Go | Services | Long-running | Large |
FAQ
Q: Is PHP outdated? A: No. Modern PHP (8.x) has a type system, performance, and tooling close to other mainstream languages. WordPress-style CMSes still dominate PHP territory. The Laravel ecosystem is very healthy.
Q: PHP vs Python for web? A: PHP is irreplaceable on shared hosting and CMS scenarios; Python has clear advantages in ML/data. At the framework level, both are mature (Laravel vs Django/FastAPI).
Q: How fast is JIT? A: CPU-bound workloads improve significantly (2-3x); web IO-bound workloads improve little (bytecode is recompiled per request). OPcache is the real key to web performance.
Sources
- Docs: https://www.php.net/docs.php
- GitHub: https://github.com/php/php-src
- License: PHP License