Opcache question from NON technical user. M2.73

Opcache question from NON technical user. M2.73

by Dom F -
Number of replies: 13

Hi 

(from non technical non-full-stack user) 

Im seeing this in the Server Enivronment report, and it looks like something that shouldnt be ignored right?

php_settingopcache.enablePHP setting should be changed.

PHP opcode caching improves performance and lowers memory requirements, OPcache extension is recommended and fully supported.

and (yes) I've "tried" to decode this  this.. https://docs.moodle.org/27/en/OPcache

And was hoping for more bitsize feedback of what the application is saying, and where the change is made,  and what i do to change this. Is this something cuased by my hosting company or nothing to do with them, and its on my plate? So to speak.

Any guidance appreciated. Ive included the phpinfo file in case any Moodle gurus who are trained to talk plain English to simpletons like me find that information useful to  help make suggestions. smile

P.S. I did read this thread and it seemed to cause that poor user no end of pain and suffering, and left him with unfixed server issues... so perhaps I am opening up a large can of Moodle shaped worms (I dont understand half of that thread too) !

D

Average of ratings: -
In reply to Dom F

Re: Opcache question from NON technical user. M2.73

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

opcache has been an "optional" component for a long time (maybe forever).  So you don't really need to worry about this message.  Somehow, I think in current moodle versions, this language might have changed.  What version of Moodle are you running?

Now, the real question is "Do you really want to run opcache?"  I forget, do you have a hosted server or a VPS?  I have a VPS (GoDaddy Linux), and do run opcache.  I find that it does improve performance a little, so I like running it.

In reply to Dom F

Re: Opcache question from NON technical user. M2.73

by Usman Asar -
Picture of Plugin developers Picture of Testers

Dom, first  thing  like Rick mentioned, opcache is not a required part, but optional, but it does improves over moodle's performance.

now, looking at your PHP file, you're on PHP 5.4.x, and until this version, opcache wasn't coming as  a part of PHP package (started coming since PHP 5.5.x onwards) so very unlikely, that your hosting provider have installed this extra extension as hosting companies tend NOT to install for it takes some extra memory from server resources, even I doubt they providing if they have PHP 5.5.x onwards. so you have to ask them if they provide OpCache


In reply to Usman Asar

Re: Opcache question from NON technical user. M2.73

by Dom F -

Thanks Usman, so I cant turn this on or OFF inside moodle? I have to get the hosting company to turn on opcache?

ALSO the million dollar question, what happens if they swutch me to PHP 5.5x onwards? Will my site crash? What if i have drupal site running elsewhere in my hosting account? Will everything fall over?

In reply to Dom F

Re: Opcache question from NON technical user. M2.73

by Usman Asar -
Picture of Plugin developers Picture of Testers

Dom, unfortunately not! you can't turn it on by yourself, unless you have full control of server (in case of VPS or Dedicated), as php.ini files are to be edited for enabling OpCache, Some hosting providers do give option to choose from various PHP versions as well as extensions (usually hosting companies on CloudLinux) as CloudLinux isolates php settings for individual accounts.

if they switch you to PHP 5.5.x or even 5.6.x, your things will keep on running as usual, no breakages  what so ever, as plenty hosting companies are on PHP 5.5 and some even have 5.6 as default, with exception of PHP 7, yes one can expect things to break when using WordPress, Drupal, Joomla, but thankfully moodle since version 3.0.1 have been tested certified for PHP 7.  So feel easy if they switch you to PHP 5.5 or even 5.6.

In reply to Usman Asar

Re: Opcache question from NON technical user. M2.73

by Dom F -

What if i have drupal site running elsewhere in my hosting account? Will everything fall over?

I have one site, several domains, several installs drupal, Moodle etc. Are they ALL governed by ONE same version of PHP? Or can I change just the one running moodle? I have to make small incremental steps (see my note further down)

In reply to Dom F

Re: Opcache question from NON technical user. M2.73

by Usman Asar -
Picture of Plugin developers Picture of Testers

Dom, very unlikely that upgrading your PHP to 5.5 or 5.6 will effect your Drupal site.

rest regarding PHP, that depends on your hosting company, most of them are setup to offer only one version of PHP to every individual sharing resources, so no matter how many sites are under one account, they are all going to be served by this one PHP version.

Then there are companies who provide you with more than 1 PHP versions to choose from, as well extensions can be enabled/disabled, but then whatever you choose will effect your WHOLE account, so meaning if you choose OpCache enabled, all your sites will have OpCache enabled, usually companies running CloudLinux as operating system offers that, as CloudLinux is purposely built for hosting companies where they isolate individual accounts.

and finally there are hosting providers, who not only let you choose more than 1 PHP versions, but as well you can customize your PHP for every individual site within your one account, so far only one provider doing that is BlueHost/HostMonster, and I haven't experienced any other else offering the same.

you have to ask from your hosting provider, what options they provide in terms of PHP settings.

In reply to Usman Asar

Re: Opcache question from NON technical user. M2.73

by Dom F -

Thankyou for the time and trouble taken with that answer. I'll do some further research based on your expert thoughts

In reply to Dom F

Re: Opcache question from NON technical user. M2.73

by Paul Verrall -

Hi Dom,

In addition to Usman's good advice. Updating PHP (if you can) is probably a good idea, however there IS a risk stuff will break with your drupal and that will depend on the version you are running. Basically php removes functions in new releases (deprecates) and if your drupal still uses them it will stumble. It may be just fine, however it might not. It's a real risk and not something to just take a punt on without testing.

Also as opcache did not come with PHP in version 5.4 we all used to install an opcache manually with PHP. This could be one of several types, e.g. APC, xcache or php-opcache itself. It may be that your PHP uses one of these already and that Moodle is just not smart enough to look for it. if this is the case you have no problem at all. If things are working fine, why change them? (well other than to keep you system patched and secure).

HTH smile

In reply to Dom F

Re: Opcache question from NON technical user. M2.73

by Dom F -
So my shared hosting account with Site5 means I cant add that option. (if I upgrade to 5.5 then does Moodle get access to opcache automatically given their policy - perhaps it is still disabled? Im still not clear)


Also upgrading to PHP 5.5 I think broke my drupal site, Im asking for them to confirm if this was what happened a few months ago when they did an automatic upgrade.


Thankyou to ALL for your kind inputs. It looks like I need to hold off on the php 5,5 upgrade and it might still not solve my error message in the plugins report.

In reply to Dom F

Re: Opcache question from NON technical user. M2.73

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

Testing everything on an experimental server is a good option, but also costs twice as much.  With some companies, you can buy a duplicate server for only the time that you need it, so it may not be as expensive as you might think.

As you continue learning about moodle and servers, you will probably start seeing the value of having experimental moodles.  Even a MoodleCloud account provides an opportunity to experiment without disrupting your "production" server.

In reply to Rick Jerz

Re: Opcache question from NON technical user. M2.73

by Dom F -

Yes this is a dev site but I just dont have the staff for damage recovery - I have to have a pretty good sense this works or is instantly reversable!

In reply to Dom F

Re: Opcache question from NON technical user. M2.73

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

I work by myself and do not have a staff either.

Make sure that you are doing backups of everything.  Some things are not reversible.

In reply to Rick Jerz

Re: Opcache question from NON technical user. M2.73

by Mark Sharp -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

It's difficult to answer the "will it break" question because we don't know what extra modules, plugins, or themes you've installed on your Drupal or Moodle sites, and when you last updated them. 

Core Moodle and Core Drupal are probably fine on PHP 5.4, 5.5 and 5.6. For some of your modules PHP 5.6 things might get a little breaky. PHP 7.0 will definitely break Moodle older than 3.0

Always always find a way to test as close to the real environment as you can. I use virtualbox on my PC to replicate the live environments. It gives me confidence that it will work out all right when I do do upgrades, and it also gives me the opportunity to fix things if there's something wrong. It really is worth investing the time and effort to test; you don't want to spend the weekend fixing things on the live environment.

Some hosting companies allow you to enable PHP modules through the .htaccess file. Check with your host.