ServerPilot OPcache php errors

Home Forums BulletProof Security Pro ServerPilot OPcache php errors

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #40618
    AITpro Admin

    Email Question:

    When I access that BPS System Info page I see the following PHP errors:

    [13-Aug-2021 06:56:49 UTC] PHP Warning: opcache_get_configuration() has been disabled for security reasons in /wp-content/plugins/bulletproof-security/admin/system-info/system-info.php on line 539
    [13-Aug-2021 07:13:29 UTC] PHP Warning:  Zend OPcache API is restricted by "restrict_api" configuration directive in /wp-content/plugins/bulletproof-security/admin/system-info/system-info.php on line 536
    AITpro Admin


    The opcache_get_configuration function has been disabled in the server’s php.ini or .user.ini file. You can either remove the opcache_get_configuration function from the disable_functions php.ini directive in the server’s php.ini or .user.ini file or just ignore this php error.

    Zend OPcache API is restricted by “restrict_api” configuration directive setting is in the opcache.ini file on ServerPilot. You can either change this configuration option setting in the opcache.ini file or just ignore this php error.
    I’ve also seen this error when installing fresh Craft 3 projects on environments running serverpilot. The issue seems to be serverpilot for me as I created the app to run on PHP 7.1, but there is a setting on PHP 7.2 forcing the opcache.restrict_api setting. I had to log in as root and then edit the file at /etc/php7.2-sp/conf.d/opcache.ini Here I saw the following:
    # The value of opcache.restrict_api is the path prefix of scripts allowed to
    # call opcache API functions:
    # Set the value as needed or comment out the line to allow all scripts to use
    # the opcache API functions.
    I just commented out the final line and saved the file. I then ran sudo service php7.2-fpm-sp restart as root and attempted the Craft install again via composer. This time it all worked fine and without issue. All other versions of PHP didn’t have this setting in, only 7.2 which I wasn’t even using as I had selected 7.1. I hope that helps you though @lukeyouell and for that matter anybody else who is using serverpilot.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.