Linux, which is commonly used for WordPress hosting, includes OPcache as part of its PHP setup. However, OPcache might not be enabled by default, or it could have limited configuration options depending on the PHP version and app settings you’re using.
To check if OPcache is installed and enabled in your Azure WordPress setup, follow these steps:
1. Create a phpinfo()
File:
You can verify OPcache by generating a phpinfo()
page:
- Create a new file named
phpinfo.php
in your WordPress directory (e.g.,/home/site/wwwroot/
). - Add the following code to it:
<?php
phpinfo();
?>
- Visit
https://yourdomain.com/phpinfo.php
in your browser.
Search for “OPcache” on the page. If it’s installed and enabled, you’ll see a section with details about the OPcache configuration.
2. Check via SSH:
Since you’re using SSH with root access in your Azure App Service, you can check the PHP configuration by logging in and running the following command:
php -i | grep -i opcache
This command will show you if OPcache is enabled and provide details about its configuration.
3. Configure OPcache:
If OPcache is not enabled or you want to adjust its settings, you can modify the php.ini
file to ensure OPcache is optimized for your WordPress site. Common settings to add or adjust include:
opcache.enable=1
opcache.memory_consumption=128
opcache.max_accelerated_files=10000
opcache.revalidate_freq=0
These configurations will improve PHP performance by ensuring scripts are cached efficiently.
Ref: PHP: OPcache – Manual
Comment below if you’d like more detailed instructions on any of these steps.
Leave a Reply