Estimated reading time: 2 min
Here are my recommended PHP settings for optimizing WordPress performance, file uploads, and script execution, based on your current setup:
Recommended PHP Settings for WordPress
Setting | Current Value | Recommended Value | Purpose |
---|---|---|---|
file_uploads | Enabled | ✅ Keep Enabled | Allows media & file uploads in WordPress. |
max_execution_time | 30 | 300 | Prevents timeout errors for long-running scripts. |
max_input_time | 60 | 300 | Prevents issues when processing large forms or file uploads. |
max_input_vars | 1000 | 3000 | Prevents menu or settings truncation in WordPress (important for themes with large menus). |
memory_limit | 128M | 256M or 512M | Prevents memory exhaustion, especially if using WooCommerce or page builders. |
post_max_size | 8M | 64M or 128M | Should be slightly larger than upload_max_filesize to allow large file uploads. |
session.gc_maxlifetime | 1440 | ✅ Keep Default | Controls session expiration (24 min). Adjust if needed. |
session.save_path | Default | ✅ Keep Default | No need to change unless session storage issues occur. |
upload_max_filesize | 2M | 64M or 128M | Allows larger media uploads (important for high-quality images/videos). |
zlib.output_compression | Disabled | ✅ Keep Disabled | Use server-level gzip compression instead (e.g., via .htaccess ). |

Why These Changes?
- Fixes upload limits: WordPress themes, plugins, and media files often exceed
2M
limits. - Prevents timeout errors: Needed for complex scripts, imports, and backups.
- Improves memory management: Some themes and plugins (like Elementor, WooCommerce) need more than
128M
. - Avoids menu truncation:
max_input_vars
prevents large menu structures from being cut off.
How to Apply These Changes?
- Edit
php.ini
file (if you have access) and update values. - Use
.htaccess
file (for shared hosting) by adding:php_value upload_max_filesize 128M php_value post_max_size 128M php_value memory_limit 512M php_value max_execution_time 300 php_value max_input_time 300 php_value max_input_vars 3000
- Modify
.user.ini
(alternative for some hosts):upload_max_filesize = 128M post_max_size = 128M memory_limit = 512M max_execution_time = 300 max_input_time = 300 max_input_vars = 3000
- Update via cPanel: If using cPanel, adjust values in Select PHP Version > Options.
Would you like help applying these changes based on your hosting setup? 🚀
Discover more from HelpZone
Subscribe to get the latest posts sent to your email.