Moodle Zend Opcache enabling

Moodle Zend Opcache enabling

by Gagan Kapoor -
Number of replies: 1

Hello, 

I have installed moodle 3.10 on ubuntu 20.04 at digitalocean droplet with the help of command line instructions given at 

https://docs.moodle.org/311/en/Step-by-step_Installation_Guide_for_Ubuntu

I am not at  IT professional and I was able to install moodle properly, thanks for the document but got stuck in the last of the document which suggests some performance tweaks like Opcache, cron job and clamAV settings. Please excuse me if I am asking very basic points

Although the documents and resource material is very good but still I have some confusions to enable them. The document says

Suggestions: Enable Zend OpCache/Change Document Root

The documents says to add opcache settings to a separate file (what I understand) and suggests a command which is

sudo vi /etc/php7/apache2/conf.d/05-opcache.ini       although  I think it should be /etc/php/7.4/conf.d/05-opcache.ini

At the above there is a link to settings that need to be added https://docs.moodle.org/26/en/OPcache  the required settings are

[opcache] 

opcache.enable = 1 

opcache.memory_consumption = 128 

opcache.max_accelerated_files = 10000 

opcache.revalidate_freq = 60

I have observed that PHP.ini file also contains these opcache settings lines that are suggested above, 

So, my confusion is 

(1) Should I create opcache.ini as mentioned in the document or uncomment these instructions in the PHP.ini file. 

(2) the document link also suggests one command         zend_extension=/full/path/to/opcache.so 

Should I need to add this to the PHP.ini file or ignore it?

I have attached the screenshot of PHP info for Zend Opcahe section from my Moodle instance, if required




Attachment Opcache message.png
Attachment Zend Opchace.png
Average of ratings: -
In reply to Gagan Kapoor

Re: Moodle Zend Opcache enabling

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

PHP reads configuration from php.ini and from other .ini files depending on the server's operating system and configuration. So it's sometimes difficult to describe exactly where changes should be made.

However from your screenshot OPcache is enabled and running so you're most of the way there. You don't need zend_extension=/full/path/to/opcache.so.

The only thing you should do is check the OPcache settings shown in your PHP info match the recommended settings:

opcache.enable = 1  opcache.enable_file_override = 0  opcache.max_accelerated_files = 10000  opcache.memory_consumption = 128...

(The link to the OPcache documentation in the Ubuntu page was to the old Moodle 2.6 page, …/26/en/OPcache. I've updated this so it links to the current version of the OPcache page).