Problem with ‘opcache_invalidate()’ upgrading to 3.4

Let me reopen the Problem with 'opcache_invalidate()' upgrading to 3.4 topic. We run the OJS at comercial webhosting where the opcache.restrict_api is used to forbid functions like opcache_invalidate().

Is there an option to configurate the OJS not to use OPcache at all, or other way hot to survive in such conditions?

thank you in advance
Petr

Hi @Petr_Novotny,

The caching implementation in OJS moved with 3.4.0 from a homebrew (not great) cache implementation to the Laravel opcache toolset. I don’t think it’s very common for providers to disable the opcache tools in the PHP configuration, but as you’ve encountered, some do. If it’s at all possible, I would ask the hosting provider to enable access to those tools for your site if they’re able.

Alternately, if you’re willing to experiment a little, you might be able to get an alternative cache implementation working with just a bit of configuration. The Laravel caching toolset supports several back ends, and OJS’s configuration is hard-coded here:

https://github.com/pkp/pkp-lib/blob/stable-3_4_0/classes/core/PKPContainer.php#L277..L286

If your server has another implementation available, you might be able to adjust the configuration to make use of it instead. While I can’t provide a ton of help with this beyond laying out the options here, I’d be interested in feedback that might lead to official support for other configuration options.

Regards,
Alec Smecher
Public Knowledge Project Team

dear @asmecher,
thank you for such prompt reaction - this is perfect. I used the “file” driver and problem solved. And agree, this could be interesting for general configuration options of OJS similar to “object_cache” directive, to enable such fallback option as a choice from predefined stores. For anybody else with similar problem:

// Cache configuration
        $items['cache'] = [
            'default' => 'opcache',  // opcache | file
            'stores' => [
                'opcache' => [
                    'driver' => 'opcache',
                    'path' => Core::getBaseDir() . '/cache/opcache'
                ],
                'file' => [
                    'driver' => 'file',
                    'path' => Core::getBaseDir() . '/cache/filecache'
                ]
            ]
        ];

I would appreciate also a config option for the cache location as don’t feel comfortable when blending code and temp, but to keep tight with the topic - SOLVED and thank you!

best
Petr

Hi @Petr_Novotny,

Thanks, that’s very helpful! This is such a straight-forward addition that I shoehorned it into the existing issue #7111 (re: caching). There are two relevant commits that will probably apply cleanly to 3.4.0-x:

This will be included with OJS/OMP/OPS 3.5.0 and later (about to enter the release candidate stage).

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like