Skip to main content
🐘

PHP

21 articles in this section

This section treats PHP as a runtime on a server, not a programming language to learn: how PHP-FPM pools and workers actually work, why OPcache matters and when to turn on JIT, and how to keep several PHP versions — 7.4, 8.1, 8.2 — side by side on one machine without breaking older projects during an upgrade.

Other guides cover the tooling around PHP: Composer and optimizing its autoloader, Xdebug for debugging without slowing down production, queues with Supervisor for Laravel and Symfony, sessions stored in Redis once a site runs on more than one server, and Swoole or RoadRunner for long-running processes instead of classic FPM.

A few practical write-ups round things out: how PHP in cron differs from PHP-FPM, reading error_log without confusing it with display_errors in production, why strict_types matters, and how to check uploaded files safely so nobody slips in a web shell.

  • PHP-FPM, OPcache and JIT: tuning for real load
  • Running multiple PHP versions and upgrading to 8.3/8.4
  • Composer, autoloading and Xdebug
  • Laravel and Symfony: deployment, queues, Redis sessions
PHP-FPM: Pools, Workers and Performance Tuning PHP-FPM setup on VPS: pool configuration, pm.max_children, pm dynamic/static/ondemand modes. Optimize PHP-FPM for maximum website performance. PHP OPcache: Setup and Byte-Code Cache Optimization PHP OPcache setup on Linux: opcache.memory_consumption, opcache.max_accelerated_files, revalidate_freq. Speed up PHP 2–10x with proper byte-code caching. Composer: Installing and Managing PHP Dependencies Install Composer on Ubuntu/Debian, create composer.json, use require/update/install commands, optimize autoloader for production. Complete Composer PHP guide. Installing PHP Extensions on Ubuntu and Debian How to install PHP extensions on Ubuntu and Debian: php-curl, php-gd, php-mbstring, php-xml. Required extensions list for WordPress, Laravel and other CMS. PHP Configuration: memory_limit and upload_max_filesize How to change memory_limit, upload_max_filesize, post_max_size and max_execution_time in PHP via php.ini, .htaccess, .user.ini and ini_set. Laravel on VPS: Installation, Nginx and Deployment Complete Laravel VPS setup guide: PHP-FPM, Nginx vhost, .env config, php artisan migrate, Supervisor for queues, cron for scheduler. PHP Security: Hardening Your Server Through php.ini Settings Secure PHP configuration: disable_functions, expose_php, open_basedir, allow_url_fopen, session security. PHP security hardening checklist for production VPS. Multiple PHP Versions on One Server: 7.4, 8.1, 8.2 Install multiple PHP versions on Ubuntu/Debian via ondrej/php PPA: PHP 7.4, 8.1, 8.2 simultaneously. Configure Nginx per-site PHP-FPM version. PHP Autoloading: Composer Autoloader Optimization Optimize Composer autoloader for production: dump-autoload --optimize, classmap generation, PSR-4 vs PSR-0. Speed up Laravel and Symfony 2–3x. PHP OPcache and JIT: fine-tuning for maximum speed Complete setup of PHP OPcache and the JIT compiler to make a site 3-5x faster. opcache.ini parameters, monitoring, optimal production values. WebSockets in PHP with Ratchet: Chat and Notifications Building a WebSocket server in PHP with the Ratchet library. Setting up chat, push notifications, and working with Nginx reverse proxy and systemd on a VPS. PHP 8.3 and 8.4 on a Server: New Features and Upgrade Timing PHP 8.3 and 8.4: key changes, version support timelines, and how to upgrade a server without downtime. Xdebug on a Server: Step Debugging and Profiling PHP Code Xdebug: server installation, step debug setup in an IDE, profiling mode, and why it must stay off in production. Symfony on a VPS: Deploy, Nginx Config, and Folder Rights Symfony on a VPS: directory layout, Nginx config for public/index.php, rights on var/cache, and common 502 errors. PHP Queues and Supervisor: Worker Processes for Laravel Supervisor for PHP queues: worker config, auto-restart, memory limits, and the usual reasons jobs get stuck. Swoole and RoadRunner: Running PHP as a Long-Lived Process Swoole and RoadRunner: how a long-lived PHP process differs from FPM, server setup, and where memory leaks come from. PHP Sessions in Redis for Multiple Web Servers PHP sessions in Redis: how to configure session.save_handler, install php-redis, and stop losing sessions behind a load balancer. PHP in Cron: How CLI Differs from FPM in Practice PHP in cron: the difference between CLI and FPM, a separate php.ini, memory and timeouts, correct crontab syntax, and job logging. PHP Logs: error_log, display_errors, and Fatal Errors PHP logs in practice: where to find error_log, how display_errors differs from log_errors, and how to read a fatal error log line. strict_types and Strict Typing in PHP Production strict_types in PHP: how declare(strict_types=1) changes type handling, where code breaks, and how to enable strict typing safely. Secure File Uploads in PHP: Type Checks and Defense Secure PHP file uploads: why extension and Content-Type are not protection, how to check the real type with finfo, and where to store files.