[Hummingbird Pro] Warning: Zend OPcache API is restricted by "restrict_api"

Hello, i have noticed this warning showing on front page today.

Warning: Zend OPcache API is restricted by "restrict_api" configuration directive in /nfsmnt/hosting1_1/6/9/69cc988d-e29a-4d86-bb42-0480ff7daf37/harmonystudio.cz/web/wp-content/plugins/wp-hummingbird/core/integration/class-opcache.php on line 44

  • Adam Czajczyk
    • Support Gorilla

    Hello Kuczys

    I hope you’re well today!

    That would usually mean that access to OPCache API was restricted – on purpose – in configuration, server side. As a consequence, it wouldn’t be possible to “control” it via code (e.g. using Hummingbird).

    Do you currently have the option to “Purge OpCache” enabled in “Hummingbird -> Caching -> Page Cache” configuration? If yes, does the warning go away with it disabled?

    Let me know, please.

    Best regards,

    Adam

  • Adam Czajczyk
    • Support Gorilla

    Hello Kuczys

    Thanks for response!

    I’ve checked with our developers and such a warning is caused by server-side restrictions – when OPCache API is not supposed (allowed) to be accessed. Hummingbird should actually be silencing such errors but still, verbose errors might be “forced” by PHP configuration.

    I would suggest talking to the host first and asking them if OPCache API can be accessed there by PHP scripts and if yes – if there are any special additional configuration requirements and if so what are they and if you/we can apply them on either PHP/webserver runtime configuration level or directly in PHP code.

    Could you check with them, please, and let me know about their response? I’ll then consult with our developers again if there’s anything additional we can do on our end.

    Best regards,

    Adam

  • Kuczys
    • Code Norris

    So I tried to update other sites and the same thing happened. So it happens after the last update.

    It happens:

    * if I am signed in to WordPress admin in Chrome. On another PC, it is invisible to the regular visitor

    * microsoft edge as regular visitor

    it won’t happen:

    * on android as regular visitor

    * on firefox as regular visitor

    * on Internet Explorer as regular visitor

  • Adam Czajczyk
    • Support Gorilla

    Hi Kuczys

    Thanks for response!

    That’s a bit strange though – OPCache is a “server-side” thing and it shouldn’t really matter at all with what browser/device you’re accessing the site.

    Since the message shows up, it means that OPCache API access is restricted so that can only be changed in server configuration and if we can’t do it, we’ll need to focus rather on silencing that warning instead. You’re right about that not happening with older versions of Hummingbird though. That’s because there was no support for OPCache before – it’s a new feature.

    That said, let’s check and try something else:

    1) check your site’s “wp-config.php” file and make sure that there’s either no line at all that says

    define( 'WP_DEBUG', true );

    or that it’s set to false like this

    define( 'WP_DEBUG', false );

    You might also add (above the /* that’s all, stop editing */ line) this line:

    define( 'WP_DEBUG_DISPLAY', false );

    After that, clear all the caches – on server (if there is any), on site and in any browser that shows the warning – and see if the warning still comes up.

    2) If above didn’t help, please:

    – create an empty text file named e.g. “phpinfo.php”

    – copy and paste following code into it

    <?php
    phpinfo();

    – save the file and upload it to root folder of you WP install

    – open the file in browser (yourdomain.com/phpinfo.php)

    – check and let me know about values of following lines:

    display_errors
    error_reporting

    – remove the “phpinfo.php” file from the server (just for security purposes; but you might want to keep it locally at hand in case we needed it again).

    Best regards,

    Adam

  • Kuczys
    • Code Norris

    // added to wp-config.php

    // this solution with WP_DEBUG didnt help stop showing

    define( ‘WP_DEBUG’, false );

    define( ‘WP_DEBUG_DISPLAY’, false );

    display_errors On On

    error_reporting 69 69

    BUT

    //after adding the line below it stops showing warnings with the same phpinfo state

    @ini_set(‘display_errors’,0);

  • Adam Czajczyk
    • Support Gorilla

    Hello Kuczys

    Thanks for letting me know.

    By adding that “ini_set” line you just changed PHP configuration in runtime to make it not show any errors and warnings. That’s actually why I asked about current status of “display_errors” option :slight_smile:

    This is fine and it will clear up this message. You just need to remember that in case of the need to troubleshoot some other issues you’ll need to either set WP_DEBUG to “true” and WP_DEBUG_LOG to “true” (to print out errors to “wp-config.php” file) or comment out that “ini_set” line.

    Best regards,

    Adam