nikhileshpaul β created an issue.
nikhileshpaul β created an issue.
Below is the approach I followed
- Create a controller with a static method which calls the
opcache_reset()
function - Expose this static method using a custom route
- Create a custom drush command, something like
drush opcl
which calls this route
Few things I had to consider
- For some unknown reason,
Drupal::httpClient()
didn't work for me and I had to go withcurl
- My application is behind a proxy so I had to set
curl_setopt($ch, CURLOPT_PROXY, '');
for the call to local server to go through - The curl call needs an absolute URL which will differ for each environment, so had to add this as a settings variable in settings.local.php
- For environments where the servers sit behind a load balancer, giving the load balancer/application URL didn't work. I had to manually add the web servers in the settings variable and loop through them resetting the cache. This might be an issue with cloud setups where servers are initialized on demand
We faced this issue immediately after a code deployment which clears cache as a final step. Noticed high CPU usage by the PHP-FPM process in web server and fixed it by restarting the FPM process
#6 does the job
Tested #16 and works fine
Issue resolved after performing a full cache clear using "drupal_flush_all_caches". "drush cr" didn't help
nikhileshpaul β created an issue.
#14 indeed works for any use case (I'm on core version 9). This is an apache level fix so should be treated as the accepted answer.
Issue exists in core version 9.5.11
Can this be merged?
Can this be merged?
Can this be merged?
Can this be merged?
@cilefen You add it as a regular form element
nikhileshpaul β created an issue.