PHP runs a large share of the web: WordPress, WooCommerce, Laravel, Symfony, Magento, Drupal and countless custom apps. Modern PHP is fast, but default settings leave a lot of performance unused and some security gaps open. This guide covers the PHP-specific configuration that makes the most difference on a VPS, whichever framework you use.
Choose a Supported PHP Version
Each PHP 8.x release brings performance improvements and receives security fixes for a limited time. Run a version that is still supported and that your application and its plugins or packages support. On Ubuntu and Debian, community repositories provide current versions side by side, so you can test a new version on staging before switching production.
php -v
php -m # loaded extensions
PHP-FPM Pool Sizing
# /etc/php/8.3/fpm/pool.d/www.conf (version in the path varies)
pm = dynamic
pm.max_children = 20
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 10
pm.max_requests = 1000
pm.status_path = /fpm-status
request_slowlog_timeout = 5s
slowlog = /var/log/php8.3-fpm-slow.log
Set pm.max_children by memory: measure average worker size under load (ps --no-headers -o rss -C php-fpm8.3 | awk '{s+=$1} END {print s/NR/1024 " MB"}') and divide the memory you can give PHP by it. Too few workers queue requests; too many cause swapping. pm.max_requests recycles workers to contain memory leaks. The slow log records stack traces of requests that exceed the timeout, which finds slow code quickly. Expose the status page only to localhost.
OPcache
; /etc/php/8.3/fpm/conf.d/10-opcache.ini
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=32
opcache.max_accelerated_files=50000
opcache.validate_timestamps=0 ; production: reload PHP-FPM on deploy
opcache.save_comments=1
; optional JIT (PHP 8.0+), benefits CPU-heavy code more than typical web requests
; opcache.jit_buffer_size=64M
OPcache keeps compiled scripts in shared memory, avoiding recompilation on every request; it is the single biggest PHP performance setting. With validate_timestamps=0, PHP never checks files for changes, so reload PHP-FPM after each deploy (systemctl reload php8.3-fpm). Check usage with a status script or opcache_get_status() and raise memory if the cache fills.
Realpath Cache
realpath_cache_size=4096K
realpath_cache_ttl=600
Frameworks include many files; caching resolved paths saves file-system calls on every request.
Sessions and Cache in Redis
File-based sessions work on one server but cause locking delays under load and do not work across several servers. Use Redis for sessions and application cache (the phpredis extension, or your framework's Redis driver), and an object cache plugin for WordPress (see our Redis guide).
Composer in Production
composer install --no-dev --optimize-autoloader --classmap-authoritative
Skip development packages, build an optimised class map, and commit composer.lock so production installs exactly what you tested. Run Composer as the deploy user, not root.
Framework-Specific Caches
- Laravel:
php artisan config:cache,route:cache,view:cache,event:cacheon each deploy (see our Laravel guide). - Symfony:
APP_ENV=prod,cache:clearandcache:warmup, and the preloading file for OPcache. - WordPress: full-page caching plus a Redis object cache; keep plugins few and maintained.
Move Slow Work to Queues
Email, image processing, PDF generation and calls to external APIs should not run inside a web request. Laravel queues, Symfony Messenger or WordPress background processing with a real cron job keep requests fast (see our workers guide). Replace WordPress's traffic-triggered WP-Cron with a system cron job calling it every few minutes.
Security Settings
expose_php = Off
display_errors = Off
log_errors = On
allow_url_include = Off
session.cookie_httponly = 1
session.cookie_secure = 1
session.use_strict_mode = 1
upload_max_filesize = 32M
post_max_size = 32M
Run each site's pool as its own Linux user, deny execution of PHP in upload directories, keep frameworks and plugins updated, and never leave debug mode on in production.
Measure
- PHP-FPM status: active processes and listen queue under load.
- The slow log for requests over a few seconds.
- Application profilers (Xdebug profiler on staging, or an APM tool) for code-level hotspots.
- Database slow query log, since PHP often waits on queries.
Sizing
| Application | EPYC plan |
|---|---|
| Company WordPress site or small Laravel app | 2 vCores / 8 GB |
| WooCommerce shop, busy Laravel app with queues | 4 vCores / 16 GB |
| Magento or large multi-site setups | 8 vCores / 32 GB |
One Pool per Application
If the server hosts several PHP applications, give each its own PHP-FPM pool running as its own Linux user, with its own pm.max_children. This isolates files and memory, so a traffic spike or a compromised plugin on one site cannot exhaust workers or read files belonging to another (see our multiple websites guide). pm = ondemand suits quiet sites; dynamic suits busy ones.
Upgrading PHP Safely
Install the new PHP version alongside the old one, create a pool for it, and switch a staging copy of the site to the new socket first. Run your tests, check logs for deprecation warnings, then switch production by changing the socket path in the web server configuration and reloading. Rolling back is just switching the socket path again. Remove the old version once nothing uses it.
Common PHP Hosting Mistakes
- OPcache disabled or too small, so scripts are recompiled constantly.
- Default pool sizes left unchanged, either queueing requests or exhausting memory.
- Debug mode or
display_errorsleft on in production. - Running unsupported PHP versions that no longer receive security fixes.
- Long tasks executed inside web requests instead of queues.
PHP Production Checklist
- Supported PHP 8.x version, tested on staging before upgrades.
- OPcache enabled and sized, with a PHP-FPM reload on every deploy.
pm.max_childrencalculated from measured worker memory.- Sessions and cache in Redis; slow work in queues.
- Composer installed with
--no-devand an optimised autoloader. - Errors logged, not displayed; PHP execution denied in upload folders.
- Slow log enabled and reviewed.
Work through it once when you launch and again after each major upgrade.
In Short
Modern PHP is fast when OPcache, PHP-FPM sizing, Redis and queues are set up properly; those settings usually matter more than a bigger plan.
SkyRainCloud Plans for This Workload
PHP capacity is set by PHP-FPM workers, each using tens of MB: 2 vCores / 8 GB runs a busy cached WordPress site or a Laravel app with its database; shops and larger apps with many uncached requests benefit from 4–8 vCores.
AMD EPYC 7C13 VPS
Dedicated KVM vCores on AMD EPYC 7C13 (up to 3.70 GHz) with DDR4 ECC memory, NVMe SSD and an unmetered 1 Gbps port.
| Plan | vCores | RAM | Storage | Network | Price | Good for | Buy |
|---|---|---|---|---|---|---|---|
| VPS 1 — AMD | 2 | 8 GB DDR4 ECC | 40 GB NVMe SSD | 1 Gbps, unmetered | ₹649/month | Websites, small APIs, bots, staging and VPN servers | Order |
| VPS 2 — AMD | 4 | 16 GB DDR4 ECC | 80 GB NVMe SSD | 1 Gbps, unmetered | ₹1,299/month | WooCommerce, Node.js/Python backends, Docker Compose stacks, CI runners | Order |
| VPS 3 — AMD | 8 | 32 GB DDR4 ECC | 150 GB NVMe SSD | 1 Gbps, unmetered | ₹2,499/month | Production databases, high-traffic sites, multi-container apps | Order |
| VPS 4 — AMD | 16 | 64 GB DDR4 ECC | 250 GB NVMe SSD | 1 Gbps, unmetered | ₹4,899/month | Large production workloads, SaaS platforms, analytics, in-memory caches | Order |
Prices are monthly in INR as listed on the SkyRainCloud store (verified 2026-11-14). Stock and final pricing are shown on the product page at checkout.