1. Websta Hosting
Performance & CDN

Using PHP OPcache for Faster PHP Execution

Using PHP OPcache for Faster PHP Execution

OPcache stores compiled PHP scripts in memory, so PHP doesn't need to recompile them on every request. It can improve PHP performance by 50โ€“80%.

Is OPcache Enabled?

Check via a phpinfo page:

<?php phpinfo();

Look for an "opcache" section showing "enabled = On".

Or via DirectAdmin โ†’ PHP Configuration โ†’ check if opcache settings appear.

OPcache Configuration

Add to your .user.ini or ask support to configure server-wide:

opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
opcache.save_comments=1

WordPress-Specific Recommendation

For WordPress, set opcache.revalidate_freq=60 (check for file changes every 60 seconds). During development, set it to 0 to always check.

Clearing OPcache

OPcache is cleared on server restart or when files change (depending on revalidate_freq). To manually clear:

  • Install the OPcache Reset WordPress plugin, or
  • Contact support to restart PHP-FPM.
Still need help?

If this article didn't answer your question, our support team can help.

Contact support
All articles More in Performance & CDN