Reputation: 101
I installed NextCloud and in the summary window it keeps telling me that my OPCache is not enabled. I have enabled it and I am seeing conflicting information about if it really is enabled or not.
Ubuntu 18.04.1 | PHP 7.2.11-2
$ sudo cat /etc/php/7.2/apache2/php.ini | grep opcache
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
;opcache.max_wasted_percentage=5
;opcache.use_cwd=1
;opcache.validate_timestamps=1
opcache.revalidate_freq=1
;opcache.revalidate_path=0
opcache.save_comments=1
;opcache.enable_file_override=0
;opcache.optimization_level=0xffffffff
;opcache.inherited_hack=1
;opcache.dups_fix=0
;opcache.blacklist_filename=
;opcache.max_file_size=0
;opcache.consistency_checks=0
;opcache.force_restart_timeout=180
;opcache.error_log=
;opcache.log_verbosity_level=1
;opcache.preferred_memory_model=
;opcache.protect_memory=0
;opcache.restrict_api=
;opcache.mmap_base=
;opcache.file_cache=
;opcache.file_cache_only=0
;opcache.file_cache_consistency_checks=1
; Implies opcache.file_cache_only=1 for a certain process that failed to
;opcache.file_cache_fallback=1
;opcache.huge_code_pages=1
;opcache.validate_permission=0
;opcache.validate_root=0
;opcache.opt_debug_level=0
Here is my output of php -i:
$ php -i
Zend OPcache
Opcode Caching => Disabled
Optimization => Disabled
SHM Cache => Enabled
File Cache => Disabled
Startup Failed => Opcode Caching is disabled for CLI
Directive => Local Value => Master Value
opcache.blacklist_filename => no value => no value
opcache.consistency_checks => 0 => 0
opcache.dups_fix => Off => Off
opcache.enable => On => On
opcache.enable_cli => Off => Off
opcache.enable_file_override => Off => Off
opcache.error_log => no value => no value
opcache.file_cache => no value => no value
opcache.file_cache_consistency_checks => 1 => 1
opcache.file_cache_only => 0 => 0
opcache.file_update_protection => 2 => 2
opcache.force_restart_timeout => 180 => 180
opcache.huge_code_pages => Off => Off
opcache.inherited_hack => On => On
opcache.interned_strings_buffer => 8 => 8
opcache.lockfile_path => /tmp => /tmp
opcache.log_verbosity_level => 1 => 1
opcache.max_accelerated_files => 10000 => 10000
opcache.max_file_size => 0 => 0
opcache.max_wasted_percentage => 5 => 5
opcache.memory_consumption => 128 => 128
opcache.opt_debug_level => 0 => 0
opcache.optimization_level => 0x7FFFBFFF => 0x7FFFBFFF
opcache.preferred_memory_model => no value => no value
opcache.protect_memory => 0 => 0
opcache.restrict_api => no value => no value
opcache.revalidate_freq => 2 => 2
opcache.revalidate_path => Off => Off
opcache.save_comments => 1 => 1
opcache.use_cwd => On => On
opcache.validate_permission => Off => Off
opcache.validate_root => Off => Off
opcache.validate_timestamps => On => On
Then finally, looking at a phpinfo() generated page, I see it loading the php.ini file from the correct one I have edited from the first block. The only additional .ini file it is loading is from the mods-available folder:
$ sudo cat /etc/php/7.2/mods-available/opcache.ini
; configuration for php opcache module
; priority=10
zend_extension=/usr/lib/php/20170718/opcache.so
There isn't any of the settings in that file, so the only file I see those settings in is the php.ini file, which is the same one being loaded from phpinfo(). These settings have been set for a while too, I am just now noticing they weren't taking affect. So the apache server has been rebooted with these settings saved. What am I missing here?
Edit:
Here are some screenshots of the phpinfo() screen for further clarification:
Upvotes: 4
Views: 14421
Reputation: 1
Also, you can check in your php.ini file if the session.cache_limiter
is set to nocache
, which doesn´t allow caching at all.
To avoid it just comment this option.
;session.cache_limiter = nocache
Upvotes: 0
Reputation: 1
Well guys... You need to set a folder where Zend Opcache can put the files. Makes that folder writable for the owner of the server.
like this :
opcache.file_cache = "/home/www/opcache"
www : refers to the path outside your files served... on the same level of "public_html" would be fine!
That solves the issue!
😊👍
Upvotes: 0
Reputation: 101
Well after playing around for a few hours, I think I figured it out. In par with what @Sammitch said. When I was doing an apt-get update, it was installing 7.3 php files for some reason. So I purged those and verified my config for php was set to default to 7.2 and then did another update and autoremove. That seemed to clear that confusion up. Not sure how that happened though.
Upvotes: 0