configuring php

configuring php

by Heather P -
Number of replies: 6

Hello

I have this message on my server environment page.

php_settingopcache.enable

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


And it says I should check it, which I duly have  and I still can't make it go away.

I'm looking at a brand new install of Moodle 3.5

I'm on
   Windows server 2016
   IIS 10
   Php 7.2
   Microsoft SQL 

I have enabled the opcache in the php.ini file.

I have put in all these settings including the revalidate path.

PHP.ini settings:

[opcache]
opcache.enable = 1
opcache.memory_consumption = 64
opcache.max_accelerated_files = 8000
opcache.revalidate_freq = 60

; Required for Moodle
opcache.use_cwd = 1
opcache.validate_timestamps = 1
opcache.save_comments = 1
opcache.enable_file_override = 0

; If something does not work in Moodle
;opcache.revalidate_path = 1 ; May fix problems with include paths
;opcache.mmap_base = 0x20000000 ; (Windows only) fix OPcache crashes with event id 487

I have purged the data folder cache and rebooted the server to be sure and it still doesn't improve.

Any thoughts on what to look for now.

It is a good size site and at the start of the academic year it will be insanely busy so I need it to go as fast as it possibly can, I presume caching is therefore important. I need to make it work.

Thank you

Heather

Average of ratings: -
In reply to Heather P

Re: configuring php

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

Are you *sure* you are editing the correct php.ini file?

Go to Site administration > Server > PHP Info.  The php.ini file(s) that are getting parsed are listed in the top section. 

Failing that, search for the about settings (e.g. opcache.enable) in the same page. Have the set values been picked up?

In reply to Howard Miller

Re: configuring php

by Heather P -

Hi

absolutely positive, checked it three times to be sure, and again just now since you asked.

It went from not enabled to giving me the message I now have and like I say even rebooted the server to be sure it had picked up the changes.

I've just no idea. 

If I have the php.info page up in Moodle on my live Moodle site if I search for opcache I get 33 references to it. If I do the same on my brand new site I get a big fat zero references when I search for it, so clearly not engaging somewhere.

Thank you

Heather

In reply to Heather P

Re: configuring php

by Heather P -

Hello

I've just realised that one of those 33 references is in the footer

 This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

That is the one above  that is working.

This is the one below that is not

 This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Does this mean I've picked up the wrong version of php as it doesn't mention having it?

Thank you

Heather

In reply to Heather P

Re: configuring php

by Heather P -

Hello

found it.

If anybody else gets this you need to put  into the php.ini file 

zend_extension=php_opcache.dll

I'm not entirely certain but I think it needs to be before 

opcache.enable=1

I think I might have seen a posting from someone else about the order of things in php.ini being important.

Once in the web server needs to be restarted.

Thank you

Heather

In reply to Heather P

Re: configuring php

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

Sounds like the opcache extension isn't loaded or isn't enabled. It should be there by default but may have been disabled. 

I don't really speak Windows but I believe the PHP loads a bunch of dlls. For example, see https://stackoverflow.com/questions/34935883/wampserver-opcache-not-showing-up-in-phpinfo

In reply to Howard Miller

Re: configuring php

by Heather P -

Hi

the opcache was enabled in the same way all the extensions are on Windows but this is something else, its almost like telling it that right, now you to have something called zend_opcache but the extension isn't called that, it is simply called opcache, you almost have to trick it.

Very odd.

Regards

Heather