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, 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"

#26 Whoops\Exception\ErrorException in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#25 Whoops\Run:handleError in <#unknown>:0
#24 opcache_invalidate in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#23 Stash\Driver\FileSystem:storeData in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#22 Stash\Driver\Composite:actOnAll in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#21 Stash\Driver\Composite:storeData in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#20 Stash\Item:executeSet in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#19 Stash\Item:set in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#18 Concrete\Core\Cache\Adapter\DoctrineCacheDriver:doSave in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#17 Doctrine\Common\Cache\CacheProvider:save in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#16 Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory:getMetadataFor in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#15 Doctrine\ORM\EntityManager:find in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#14 Concrete\Core\File\File:getByID in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#13 include in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#12 Concrete\Core\Block\View\BlockView:renderViewContents in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#11 Concrete\Core\View\AbstractView:render in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#10 Concrete\Core\Area\Area:display in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#9 include in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#8 Concrete\Core\View\View:inc in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#7 include in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#6 Concrete\Core\View\View:renderViewContents in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#5 Concrete\Core\View\AbstractView:render in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#4 Concrete\Core\Routing\DispatcherRouteCallback:sendResponse in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#3 Concrete\Core\Routing\DispatcherRouteCallback:execute in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#2 Concrete\Core\Application\Application:dispatch in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#1 require in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/
#0 require in /nfsmnt/hosting1_1/c/a/cad94d54-8b2e-4827-9da8-69ace704f0af/

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,



View Replies:
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


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


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


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


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. . 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
Hi @cmcg,

Yes i'm facing the same issue. The website of my client 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!

aZuL2001 replied on at Permalink Reply
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
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 Reply
I am running v8.1.0 and had this issue on Rackspace cloud sites hosting. To fix this, edit:


Around line 239 change:

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

... to:
if (function_exists('opcache_invalidate')) {
            @opcache_invalidate($path, true);