PHP & Python Settings in Plesk
How to switch PHP versions per domain in Plesk, customize php.ini values, set up Python applications, and manage runtime settings.
Switch PHP version per domain
Customize php.ini values
From the same PHP Settings page:
- Scroll to the Additional configuration directives section
- Enter custom
php.inivalues, one per line:
memory_limit = 512M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
max_input_vars = 3000
display_errors = Off
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
- Click OK: changes apply immediately without restart
Common settings for WordPress/WooCommerce
| Setting | Recommended | Why |
|---|---|---|
memory_limit | 512M | WooCommerce with many products needs headroom |
upload_max_filesize | 64M | Large media uploads |
max_execution_time | 300 | Long-running imports/exports |
max_input_vars | 5000 | Complex product attributes in WooCommerce |
PHP performance settings
Enable OPcache for faster PHP execution:
opcache.enable = 1
opcache.memory_consumption = 256
opcache.interned_strings_buffer = 16
opcache.max_accelerated_files = 20000
opcache.revalidate_freq = 60
PHP modes
Plesk supports multiple PHP execution modes:
| Mode | Description | Recommended |
|---|---|---|
| FPM | Separate process pool per subscription | Yes: best isolation |
| FPM + Apache | FPM with Apache as reverse proxy | Yes on Nginx+Apache setups |
| CGI | Spawns new process per request | No: slow |
| FastCGI | Persistent FastCGI process | Acceptable |
Set under PHP Settings → PHP execution mode.
Python applications
Plesk supports hosting Python (Django, Flask) apps via Passenger:
- Subscription → Websites & Domains → Python
- Click Enable
- Set the Python version and application root
- Set the startup file (e.g.
passenger_wsgi.py) - Click OK
Example passenger_wsgi.py for Flask:
import sys
import os
INTERP = "/var/www/vhosts/yourdomain.com/venv/bin/python"
if sys.executable != INTERP:
os.execl(INTERP, INTERP, *sys.argv)
from app import app as application
Restart the app after code changes: Python → Restart.