phpopcode enable

phpopcode enable

by Doug Moody -
Number of replies: 6

I have been wracking my brain trying to figure out this phpopcode extension. When upgrading my site to 3.1, I get a yellow recommendation to add this extension. But the only way to do it is by apparently commenting out that line in my php.ini file. 

However, I do not see such a line to comment out in my php.ini file. SO I am at a loss.

Ideas please?

Average of ratings: -
In reply to Doug Moody

Re: phpopcode enable

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

It would help to know what your operating system is, PHP version and how PHP was installed. 

Which instructions are you reading?

In reply to Doug Moody

Re: phpopcode enable

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Doug, are you talking about the yellow warning next to "opcache.enable" in the environment summary?

In reply to Rick Jerz

Re: phpopcode enable

by Doug Moody -

Rick,


Yes. That's the one. Do you know anything about it?

In reply to Doug Moody

Re: phpopcode enable

by Jeff Noel -

Is the extension already installed in your PHP instance? If it is and you still get the warning, give a try at my PHPOpCache (linked to OpCode) config (in php.ini):



[opcache]
opcache.enable = 1
opcache.memory_consumption = 128
opcache.max_accelerated_files = 4000
opcache.revalidate_freq = 60
 
; Required for Moodle
opcache.use_cwd = 1
opcache.validate_timestamps = 1
opcache.save_comments = 1
opcache.enable_file_override = 0

[Config Moodle]
memory_limit=256M
post_max_size = 1024M
max_execution_time = 300
In reply to Doug Moody

Re: phpopcode enable

by Usman Asar -
Picture of Plugin developers Picture of Testers

Doug,

Jeff has already written the code, but it depends, if you are on PHP 5.4, then you have to install opcache extension separately, else from PHP 5.5 onwards, this comes as a part of PHP already, all you have to do is copy the code Jeff wrote in your php.ini file and you're good to go.

You can skip the last moodle config section for these are the settings your may have already have in place.

additionally, this Jeff's code wont automatically enable opcache extension and get rid of exclamation mark, there is additional line that needs to be mentioned, so if you are on Linux platform, then add this line into your php.ini

zend_extension=/full/path/to/opcache.so

if you're on Windows platform, then add this line instead

zend_extension=php_opcache.dll

You will be adding these lines BEFORE what Jeff mentioned.

and last but not least, as you mentioned Moodle 3.1, then change the figure to 8000 in this line

opcache.max_accelerated_files = 4000 (change to 8000, for moodle 3+ has more files to be cached)



In reply to Doug Moody

Re: phpopcode enable

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Doug, okay.  I think that you might have two choices:

1) Ignore it.  It is only a warning.

2) Get opcache working on your site.  This will remove the warning message, and make your Moodle perform a little better.

Which solution do you prefer?

I do see some others helping too.  Maybe you already have this problem resolved.

I actually picked #2 for my small moodle.  Yep, a little editing of php.ini necessary, but not too bad.

(I will watch for your posts.)