Antonio Gargiulo
Antonio Gargiulo

Reputation: 63

OPcache settings for drupal -which file? and what are the proper setting?

First of all, i need to say: "It's been a long time since I installed last time drupal" The last Drupal I used was Drupal 7.

I already spent 1 week to try and retry again. (by reinstalling about 10 times from zero Ubuntu 22.04 with Nginx) (consulting 7 different guides and all of them had some mistakes) Now, I was able to install Drupal10 and make it work. But I want more: activate OPcache

On my server I have 2 php.ini :

/etc/php/8.1/cli/php.ini

/etc/php/8.1/fpm/php.ini

I guess the one responsible for Drupal is the second one: /etc/php/8.1/fpm/php.ini But I am not sure and I am asking you

Both of the files have OPcache online 1765 but which one do I need to modify? it is for sure /etc/php/8.1/fpm/php.ini ?

For the settings, I found this:

opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1

Is it correct? or i need modify something else?

Thank to all that help

Upvotes: 1

Views: 169

Answers (1)

Pobtastic
Pobtastic

Reputation: 271

When running Drupal, you use PHP via both the command line (when using say drush, or just PHP in general in your shell) and also on the web server which is serving Drupal.

These days, most PHP installations use php-fpm (FastCGI Process Manager) as it's now in PHP core (now I've checked, as of 5.3.3). So the "fpm" folder relates to the PHP that your web server is using. And, in case it's not obvious, the "cli" folder relates to the PHP you use for drush/ PHP commands on the command line.

You can see that the web version is installed if you go to: /admin/reports/status/php

And the cli version using: php --info|grep "opcache\."

As for the settings themselves, really - it depends on your application, and how your Drupal application is set up to utilise opcache. For now, the configs you've posted are fine and just alter them in both places.

Upvotes: 0

Related Questions