Stack guide — PHP 8.5
PHP 8.5
PHP 8.5 runs through php-fpm behind nginx on Akadata Linux. The CLI is available for scripting, and the opcache extension is enabled for production performance. Every extension is compiled from source by the deterministic build controller.
Extensions
What is installed
The following extensions are compiled into PHP 8.5 on Akadata Linux:
Core
opensslcurlmbstringfileinfointlsodium
Database
pdo_mysqlmysqlipdo_sqlitesqlite3
Performance
opcachezlibxmljsondom
Extensions not currently packaged include gd, imagick, redis, and memcached. Those will be added in future releases. If you need one now, build it from source into /usr/local or package it into stage4.
# Verify loaded extensions:
php -m
# Check a specific extension:
php -r 'echo extension_loaded("pdo_mysql") ? "yes\n" : "no\n";'php-fpm
Configuration and pools
The php-fpm master configuration is at /etc/php/php-fpm.conf. Pool definitions live in /etc/php/fpm.d/. The default pool listens on a Unix socket:
# /etc/php/fpm.d/www.conf
[www]
listen = /run/php-fpm/www.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0660
user = nginx
group = nginx
pm = dynamic
pm.max_children = 20
pm.start_servers = 4
pm.min_spare_servers = 2
pm.max_spare_servers = 8For multiple applications, create separate pools with their own sockets. Each pool can run as a different user with its own resource limits:
# /etc/php/fpm.d/app2.conf
[app2]
listen = /run/php-fpm/app2.sock
listen.owner = nginx
listen.group = nginx
user = myapp
group = myapp
pm = ondemand
pm.max_children = 10
pm.process_idle_timeout = 10sPoint nginx at the socket with fastcgi_pass unix:/run/php-fpm/www.sock;. See the Web Server stack guide for a full nginx + php-fpm vhost configuration.
opcache
Production opcache tuning
opcache stores compiled PHP bytecode in shared memory, eliminating the need to parse and compile scripts on every request. A reasonable production configuration:
; /etc/php/conf.d/opcache.ini
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.revalidate_freq=2
opcache.validate_timestamps=1
opcache.enable_cli=0For truly static deployments where code never changes, set opcache.validate_timestamps=0 and reload php-fpm when you deploy new code. This eliminates the periodic stat() calls and gives a measurable performance improvement.
# Check opcache status:
php -r 'print_r(opcache_get_status());'
# Check opcache configuration:
php -r 'print_r(opcache_get_configuration());'Scripting
CLI scripts and /usr/local
PHP CLI scripts belong in /usr/local/bin or /usr/local/php. These directories are outside the distribution tree and survive system updates:
#!/usr/bin/env php
<?php
$pdo = new PDO('sqlite:/usr/local/db/myapp.db');
$pdo->exec('CREATE TABLE IF NOT EXISTS tasks (
id INTEGER PRIMARY KEY,
title TEXT NOT NULL,
done INTEGER DEFAULT 0
)');
$stmt = $pdo->query('SELECT title FROM tasks WHERE done = 0');
foreach ($stmt as $row) {
echo "[ ] " . $row['title'] . "\n";
}Make it executable:
chmod +x /usr/local/bin/todoPHP scripts in /usr/local are yours. Back them up, move them between servers, or mount /usr/local independently. The runtime and extensions are part of the base distribution and do not change.
