Error on first login - "Zend OPcache API is restricted by "restrict_api" configuration directive" after successful install

Permalink 1 user found helpful
Hi all,

after more than several attempts I finally managed to install 5.7.4.2, yay.

Immediately after the install I login to the site to savour the fruits of my hard labour. However, I am welcomed by this:

Whoops\Exception\ErrorException thrown with message "Zend OPcache API is restricted by "restrict_api" configuration directive"

Stacktrace:
#26 Whoops\Exception\ErrorException in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/vendor/tedivm/stash/src/Stash/Driver/FileSystem.php:286
#25 Whoops\Run:handleError in <#unknown>:0
#24 opcache_invalidate in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/vendor/tedivm/stash/src/Stash/Driver/FileSystem.php:286
#23 Stash\Driver\FileSystem:storeData in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/vendor/tedivm/stash/src/Stash/Driver/Composite.php:148
#22 Stash\Driver\Composite:actOnAll in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/vendor/tedivm/stash/src/Stash/Driver/Composite.php:103
#21 Stash\Driver\Composite:storeData in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/vendor/tedivm/stash/src/Stash/Item.php:353
#20 Stash\Item:executeSet in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/vendor/tedivm/stash/src/Stash/Item.php:305
#19 Stash\Item:set in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/src/Cache/Adapter/DoctrineCacheDriver.php:76
#18 Concrete\Core\Cache\Adapter\DoctrineCacheDriver:doSave in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php:115
#17 Doctrine\Common\Cache\CacheProvider:save in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php:214
#16 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory:getMetadataFor in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:360
#15 Doctrine\ORM\EntityManager:find in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/src/File/File.php:90
#14 Concrete\Core\File\File:getByID in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/blocks/image_slider/view.php:37
#13 include in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/src/Block/View/BlockView.php:234
#12 Concrete\Core\Block\View\BlockView:renderViewContents in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/src/View/AbstractView.php:123
#11 Concrete\Core\View\AbstractView:render in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/src/Area/Area.php:862
#10 Concrete\Core\Area\Area:display in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/themes/elemental/default.php:9
#9 include in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/src/View/View.php:74
#8 Concrete\Core\View\View:inc in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/themes/elemental/full.php:3
#7 include in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/src/View/View.php:189
#6 Concrete\Core\View\View:renderViewContents in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/src/View/AbstractView.php:123
#5 Concrete\Core\View\AbstractView:render in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/src/Routing/DispatcherRouteCallback.php:24
#4 Concrete\Core\Routing\DispatcherRouteCallback:sendResponse in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/src/Routing/DispatcherRouteCallback.php:213
#3 Concrete\Core\Routing\DispatcherRouteCallback:execute in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/src/Application/Application.php:369
#2 Concrete\Core\Application\Application:dispatch in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/bootstrap/start.php:284
#1 require in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/concrete/dispatcher.php:36
#0 require in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/harmonymama.sk/web/concrete5.7.4.2/index.php:2

I am able to view the dashboard, however, I cannot view any pages of my site (did the install including the default site and theme). As soon as I try to navigate to them from the dashboard, I get the error.

So far I tried adding some Zend OPcache parameters into the .ini file. The file the error is referring to is in the core folder. Is this an app bug? Can anyone help? Also, will there ever be a 5.7+ version of c5 that's stable? :)

Thanks for your help,

Best,

Matus

yoga
 
andreicristescu replied on at Permalink Reply
I had the same problem because my provider had the opcache in php deactivated. First they helped me but after every concrete5 update I had to ask them again to help me with that, so I tried for myself to do it (Done it in concrete5.7.5). So that's what I need to do to make that error dissapear:

concrete/src/Cache/OpCache.php :Delete file or rename



concrete/vendor/tedivm/stash/src/Stash/Driver/FileSystem.php

Line 286 ("opcache_invalidate($path, true);") : php comment



concrete/src/Config/DirectFileSaver.php

Line 5 ("use Concrete\Core\Cache\OpCache;") : php comment or delete



concrete/src/Config/FileSaver.php

Line 5 ("use Concrete\Core\Cache\OpCache;") : php comment or delete
Line 100 ("if ($result) { OpCache::clear($file);} return $result;") :delete



concrete/src/Application/Application.php

Line 8 ("use Concrete\Core\Cache\OpCache;") : php comment or delete
Line 125 ("OpCache::clear();") : php comment or delete


Hope that helps! :)
cmcg replied on at Permalink Reply
Thanks for this. I am getting this error now with all 5.7 sites "Zend OPcache API is restricted by "restrict_api" configuration directive". I need to refresh the site many time to get it to load. With the 8.01 it wont load at all without following your work around here, although code lines have moved a bit with version 8. I have tried php_flag opcache.enable Off in .htaccess, but does'nt seem to help. The Host pointed me to this Topic here which explains in more detail.https://www.interactivetools.com/forum/forum-posts.php?page=1&E_... . Just wondered if anyone else if having this issue and if there is an option for a permanent fix?
dexterweb replied on at Permalink Reply
dexterweb
Hi @cmcg,

Yes i'm facing the same issue. The website of my clienthttp://deburen.nu/ is running on C5.7.5.13 / PHP7 and hosted on a shared environment by TransIP. They disabled OPcache and now they don't seem to be very helpful.

Hope any one will come with a permanent solution soon too!

Cheers!
aZuL2001 replied on at Permalink Reply
aZuL2001
Hmmm. Transip.
I'm running into the same issue there.

No recent (v8.03) workaround available?

Edit: Advice from TransIP: Host somewhere else
So hosting is not important to them apparently.
buurvrouw replied on at Permalink Reply
buurvrouw
I see your site is running again. How did you manage to get it running? I'm having the same problem on a trans-ip hosted website.
jmcgarvey replied on at Permalink Best Answer Reply
jmcgarvey
I am running v8.1.0 and had this issue on Rackspace cloud sites hosting. To fix this, edit:

\concrete\vendor\tedivm\stash\src\Stash\Driver\file_system.php

Around line 239 change:

if (function_exists('opcache_invalidate')) {
            opcache_invalidate($path, true);
        }


... to:
if (function_exists('opcache_invalidate')) {
            @opcache_invalidate($path, true);
        }
yoga replied on at Permalink Reply
yoga
Thx jmc,
issue resolved
m.
dexterweb replied on at Permalink Reply
dexterweb
It worked!
Thanx for the great help!