• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Cannot enable opcache

John S.

New Pleskian
I cannot enable opcache for PHP 5.5.38, phpinfo() shows

Zend OPcache
Opcode Caching Disabled
Optimization Disabled

I tried three options with no success:

1. Switching opchache On in Domain->PHP Settings
2. Adding PHP directives directly on the same PHP settings page:
Code:
opcache.enable=1
opcache.memory_consumption=128
opcache.max_accelerated_files=4000
opcache_revalidate_freq = 240

3. Adding the above directives into php ini files in

/opt/plesk/php/5.5/etc

or

/var/www/vhosts/system/mydomaincom/etc

The same result - opcacne is not enabled and shows as disabled in phpinfo().

Note. Enabling opcache works perfectly find for PHP 7. Why cannot I enable it for PHP 5.5?

What am I doing wrong?

Thanks
 
Last edited:
Check that in file /opt/plesk/php/5.5/etc/php.d/10-opcache.ini you have:

opcache.enable=1
 
Check that in file /opt/plesk/php/5.5/etc/php.d/10-opcache.ini you have:

opcache.enable=1
Thanks Igor! It is working now!!!

I still cannot enable any installed pecl extensions except for PHP 5.4.45, but it is a different story.
 
Check that in file /opt/plesk/php/5.5/etc/php.d/10-opcache.ini you have:

opcache.enable=1

Ah, thanks. We are setting up a new server (created Feb 2019) with a handful of PHP 5.5 sites. Apparently the default in that file is to have it off? I've not edited it. All other versions have it commented out:

# grep opcache.enable= /opt/plesk/php/*/etc/php.d/10-opcache.ini
/opt/plesk/php/5.5/etc/php.d/10-opcache.ini: opcache.enable=0
/opt/plesk/php/5.6/etc/php.d/10-opcache.ini:; opcache.enable=1
/opt/plesk/php/7.1/etc/php.d/10-opcache.ini:; opcache.enable=1
/opt/plesk/php/7.2/etc/php.d/10-opcache.ini:; opcache.enable=1
/opt/plesk/php/7.3/etc/php.d/10-opcache.ini:; opcache.enable=1

# ll /opt/plesk/php/*/etc/php.d/10-opcache.ini
-rw-r--r-- 1 root root 4567 Sep 1 2017 /opt/plesk/php/5.5/etc/php.d/10-opcache.ini
-rw-r--r-- 1 root root 4599 Jan 10 23:10 /opt/plesk/php/5.6/etc/php.d/10-opcache.ini
-rw-r--r-- 1 root root 4829 Mar 10 22:22 /opt/plesk/php/7.1/etc/php.d/10-opcache.ini
-rw-r--r-- 1 root root 4829 Mar 10 23:14 /opt/plesk/php/7.2/etc/php.d/10-opcache.ini
-rw-r--r-- 1 root root 4829 Mar 10 23:14 /opt/plesk/php/7.3/etc/php.d/10-opcache.ini

It looks like commenting out that "opcache.enable=0" line is sufficient to let opcache work in PHP 5.5, if the domain's PHP Settings have it set to On.
 
@SteveITS Perhaps "opcache.enable=0" is due to the fact that it appeared exactly from PHP version 5.5, where it was an as experimental feature not included by default.
In fact, it is a very bad idea to use such old and EOLed PHP versions for projects.
 
Back
Top