Best PHP Settings for WordPress

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

SettingCurrent ValueRecommended ValuePurpose
file_uploadsEnabled✅ Keep EnabledAllows media & file uploads in WordPress.
max_execution_time30300Prevents timeout errors for long-running scripts.
max_input_time60300Prevents issues when processing large forms or file uploads.
max_input_vars10003000Prevents menu or settings truncation in WordPress (important for themes with large menus).
memory_limit128M256M or 512MPrevents memory exhaustion, especially if using WooCommerce or page builders.
post_max_size8M64M or 128MShould be slightly larger than upload_max_filesize to allow large file uploads.
session.gc_maxlifetime1440✅ Keep DefaultControls session expiration (24 min). Adjust if needed.
session.save_pathDefault✅ Keep DefaultNo need to change unless session storage issues occur.
upload_max_filesize2M64M or 128MAllows larger media uploads (important for high-quality images/videos).
zlib.output_compressionDisabled✅ Keep DisabledUse 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?

  1. Edit php.ini file (if you have access) and update values.
  2. 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
  3. 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
  4. 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.

Want to support us? Let friends in on the secret and share your favorite post!

Photo of author

Flo

Best PHP Settings for WordPress

Published

Update

Welcome to HelpZone.blog, your go-to hub for expert insights, practical tips, and in-depth guides across technology, lifestyle, business, entertainment, and more! Our team of passionate writers and industry experts is dedicated to bringing you the latest trends, how-to tutorials, and valuable advice to enhance your daily life. Whether you're exploring WordPress tricks, gaming insights, travel hacks, or investment strategies, HelpZone is here to empower you with knowledge. Stay informed, stay inspired because learning never stops! 🚀

👍 Like us on Facebook!

Closing in 10 seconds

Leave a Reply