Jump to content

Recommended Posts

We are running our Moodle server on AWS using the Ubuntu 18.04 bionic AMI. Almost twice a second we are getting the message "Cannot load Zend OPcache - it was already loaded" in /var/log/apache2/error.log. We have them set up in auto-scaling groups to spin up or down with workload.

PHP 7.2.24-0ubuntu0.18.04.4 (cli) (built: Apr 8 2020 15:45:57) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.24-0ubuntu0.18.04.4, Copyright (c) 1999-2018, by Zend Technologies

Our php version is 7.2. I've looked around quite a bit and most people are getting this error due to having 2 versions of opcache.ini in /etc/php/7.2/cli/conf.d but this isn't the case for me:

ls /etc/php/7.2/cli/conf.d 10-opcache.ini 20-apcu_bc.ini 20-curl.ini 20-ftp.ini 20-igbinary.ini 20-mbstring.ini 20-posix.ini 20-simplexml.ini 20-sysvsem.ini 20-xmlreader.ini 20-zip.ini 10-pdo.ini 20-bcmath.ini 20-dom.ini 20-gd.ini 20-intl.ini 20-pdo_pgsql.ini 20-readline.ini 20-soap.ini 20-sysvshm.ini 20-xmlrpc.ini 15-xml.ini 20-calendar.ini 20-exif.ini 20-gettext.ini 20-json.ini 20-pgsql.ini 20-redis.ini 20-sockets.ini 20-tokenizer.ini 20-xmlwriter.ini 20-apcu.ini 20-ctype.ini 20-fileinfo.ini 20-iconv.ini 20-ldap.ini 20-phar.ini 20-shmop.ini 20-sysvmsg.ini 20-wddx.ini 20-xsl.ini

How else can I troubleshoot this? It has been spamming the logs for quite a while. Let me know if there is any other relevant info I can add.

On 4/27/2020 at 4:21 PM, requinix said:

Have you tried grepping for any files that mention opcache?

I just ran a grep -r for the string opcache and there are hundreds if not thousands of results. Anything specific I should be looking for in the results?

Actually, before that,
You're having the problem through Apache but you were looking at the CLI configuration files. You need to look in /etc/php/7.2/apache2 (I think) for the appropriate configuration files.

But if you still don't see it there, first grep through /etc/php/7.2/apache2. There should not be many results at all. Look for references to the INI file or the extension's .so.
The next place would be /etc/apache2 in case someone put PHP configuration settings in there.
After that comes your website's configuration.

3 hours ago, requinix said:

Actually, before that,
You're having the problem through Apache but you were looking at the CLI configuration files. You need to look in /etc/php/7.2/apache2 (I think) for the appropriate configuration files.

But if you still don't see it there, first grep through /etc/php/7.2/apache2. There should not be many results at all. Look for references to the INI file or the extension's .so.
The next place would be /etc/apache2 in case someone put PHP configuration settings in there.
After that comes your website's configuration.

Thanks for the response!

 

I'm looking in /etc/php/7.2/apache2/conf.d/ and here is the list of files, looks like the linking to /etc/php/7.2/mods-available:

/etc/php/7.2/apache2/conf.d$ ls -l
total 0
lrwxrwxrwx 1 root root 39 Oct 22  2018 10-opcache.ini -> /etc/php/7.2/mods-available/opcache.ini
lrwxrwxrwx 1 root root 35 Oct 22  2018 10-pdo.ini -> /etc/php/7.2/mods-available/pdo.ini
lrwxrwxrwx 1 root root 35 Oct 22  2018 15-xml.ini -> /etc/php/7.2/mods-available/xml.ini
lrwxrwxrwx 1 root root 36 Oct 22  2018 20-apcu.ini -> /etc/php/7.2/mods-available/apcu.ini
lrwxrwxrwx 1 root root 39 Oct 22  2018 20-apcu_bc.ini -> /etc/php/7.2/mods-available/apcu_bc.ini
lrwxrwxrwx 1 root root 38 Feb 14  2019 20-bcmath.ini -> /etc/php/7.2/mods-available/bcmath.ini
lrwxrwxrwx 1 root root 40 Oct 22  2018 20-calendar.ini -> /etc/php/7.2/mods-available/calendar.ini
lrwxrwxrwx 1 root root 37 Oct 22  2018 20-ctype.ini -> /etc/php/7.2/mods-available/ctype.ini
lrwxrwxrwx 1 root root 36 Oct 22  2018 20-curl.ini -> /etc/php/7.2/mods-available/curl.ini
lrwxrwxrwx 1 root root 35 Oct 22  2018 20-dom.ini -> /etc/php/7.2/mods-available/dom.ini
lrwxrwxrwx 1 root root 36 Oct 22  2018 20-exif.ini -> /etc/php/7.2/mods-available/exif.ini
lrwxrwxrwx 1 root root 40 Oct 22  2018 20-fileinfo.ini -> /etc/php/7.2/mods-available/fileinfo.ini
lrwxrwxrwx 1 root root 35 Oct 22  2018 20-ftp.ini -> /etc/php/7.2/mods-available/ftp.ini
lrwxrwxrwx 1 root root 34 Oct 22  2018 20-gd.ini -> /etc/php/7.2/mods-available/gd.ini
lrwxrwxrwx 1 root root 39 Oct 22  2018 20-gettext.ini -> /etc/php/7.2/mods-available/gettext.ini
lrwxrwxrwx 1 root root 37 Oct 22  2018 20-iconv.ini -> /etc/php/7.2/mods-available/iconv.ini
lrwxrwxrwx 1 root root 40 Nov  6  2018 20-igbinary.ini -> /etc/php/7.2/mods-available/igbinary.ini
lrwxrwxrwx 1 root root 36 Oct 22  2018 20-intl.ini -> /etc/php/7.2/mods-available/intl.ini
lrwxrwxrwx 1 root root 36 Oct 22  2018 20-json.ini -> /etc/php/7.2/mods-available/json.ini
lrwxrwxrwx 1 root root 36 Oct 22  2018 20-ldap.ini -> /etc/php/7.2/mods-available/ldap.ini
lrwxrwxrwx 1 root root 40 Oct 22  2018 20-mbstring.ini -> /etc/php/7.2/mods-available/mbstring.ini
lrwxrwxrwx 1 root root 41 Oct 22  2018 20-pdo_pgsql.ini -> /etc/php/7.2/mods-available/pdo_pgsql.ini
lrwxrwxrwx 1 root root 37 Oct 22  2018 20-pgsql.ini -> /etc/php/7.2/mods-available/pgsql.ini
lrwxrwxrwx 1 root root 36 Oct 22  2018 20-phar.ini -> /etc/php/7.2/mods-available/phar.ini
lrwxrwxrwx 1 root root 37 Oct 22  2018 20-posix.ini -> /etc/php/7.2/mods-available/posix.ini
lrwxrwxrwx 1 root root 40 Oct 22  2018 20-readline.ini -> /etc/php/7.2/mods-available/readline.ini
lrwxrwxrwx 1 root root 37 Nov  6  2018 20-redis.ini -> /etc/php/7.2/mods-available/redis.ini
lrwxrwxrwx 1 root root 37 Oct 22  2018 20-shmop.ini -> /etc/php/7.2/mods-available/shmop.ini
lrwxrwxrwx 1 root root 41 Oct 22  2018 20-simplexml.ini -> /etc/php/7.2/mods-available/simplexml.ini
lrwxrwxrwx 1 root root 36 Oct 22  2018 20-soap.ini -> /etc/php/7.2/mods-available/soap.ini
lrwxrwxrwx 1 root root 39 Oct 22  2018 20-sockets.ini -> /etc/php/7.2/mods-available/sockets.ini
lrwxrwxrwx 1 root root 39 Oct 22  2018 20-sysvmsg.ini -> /etc/php/7.2/mods-available/sysvmsg.ini
lrwxrwxrwx 1 root root 39 Oct 22  2018 20-sysvsem.ini -> /etc/php/7.2/mods-available/sysvsem.ini
lrwxrwxrwx 1 root root 39 Oct 22  2018 20-sysvshm.ini -> /etc/php/7.2/mods-available/sysvshm.ini
lrwxrwxrwx 1 root root 41 Oct 22  2018 20-tokenizer.ini -> /etc/php/7.2/mods-available/tokenizer.ini
lrwxrwxrwx 1 root root 36 Oct 22  2018 20-wddx.ini -> /etc/php/7.2/mods-available/wddx.ini
lrwxrwxrwx 1 root root 41 Oct 22  2018 20-xmlreader.ini -> /etc/php/7.2/mods-available/xmlreader.ini
lrwxrwxrwx 1 root root 38 Oct 22  2018 20-xmlrpc.ini -> /etc/php/7.2/mods-available/xmlrpc.ini
lrwxrwxrwx 1 root root 41 Oct 22  2018 20-xmlwriter.ini -> /etc/php/7.2/mods-available/xmlwriter.ini
lrwxrwxrwx 1 root root 35 Oct 22  2018 20-xsl.ini -> /etc/php/7.2/mods-available/xsl.ini
lrwxrwxrwx 1 root root 35 Oct 22  2018 20-zip.ini -> /etc/php/7.2/mods-available/zip.ini

And here are the contents of opcache.ini

/etc/php/7.2/mods-available$ cat opcache.ini
; configuration for php opcache module
; priority=10
zend_extension=opcache.so

And here is what I get when I do a grep -r 'opcache' . of the php directory

/etc/php/7.2$ sudo grep -r 'opcache' .
./mods-available/opcache.ini:; configuration for php opcache module
./mods-available/opcache.ini:zend_extension=opcache.so
./cli/php.ini:[opcache]
./cli/php.ini:;opcache.enable=1
./cli/php.ini:;opcache.enable_cli=0
./cli/php.ini:;opcache.memory_consumption=128
./cli/php.ini:;opcache.interned_strings_buffer=8
./cli/php.ini:;opcache.max_accelerated_files=10000
./cli/php.ini:;opcache.max_wasted_percentage=5
./cli/php.ini:;opcache.use_cwd=1
./cli/php.ini:;opcache.validate_timestamps=1
./cli/php.ini:;opcache.revalidate_freq=2
./cli/php.ini:;opcache.revalidate_path=0
./cli/php.ini:;opcache.save_comments=1
./cli/php.ini:;opcache.enable_file_override=0
./cli/php.ini:;opcache.optimization_level=0xffffffff
./cli/php.ini:;opcache.inherited_hack=1
./cli/php.ini:;opcache.dups_fix=0
./cli/php.ini:;opcache.blacklist_filename=
./cli/php.ini:;opcache.max_file_size=0
./cli/php.ini:;opcache.consistency_checks=0
./cli/php.ini:;opcache.force_restart_timeout=180
./cli/php.ini:;opcache.error_log=
./cli/php.ini:;opcache.log_verbosity_level=1
./cli/php.ini:;opcache.preferred_memory_model=
./cli/php.ini:;opcache.protect_memory=0
./cli/php.ini:;opcache.restrict_api=
./cli/php.ini:;opcache.mmap_base=
./cli/php.ini:;opcache.file_cache=
./cli/php.ini:;opcache.file_cache_only=0
./cli/php.ini:;opcache.file_cache_consistency_checks=1
./cli/php.ini:; Implies opcache.file_cache_only=1 for a certain process that failed to
./cli/php.ini:;opcache.file_cache_fallback=1
./cli/php.ini:;opcache.huge_code_pages=1
./cli/php.ini:;opcache.validate_permission=0
./cli/php.ini:;opcache.validate_root=0
./cli/php.ini:;opcache.opt_debug_level=0
./cli/php.ini.ucf-dist:[opcache]
./cli/php.ini.ucf-dist:;opcache.enable=1
./cli/php.ini.ucf-dist:;opcache.enable_cli=0
./cli/php.ini.ucf-dist:;opcache.memory_consumption=128
./cli/php.ini.ucf-dist:;opcache.interned_strings_buffer=8
./cli/php.ini.ucf-dist:;opcache.max_accelerated_files=10000
./cli/php.ini.ucf-dist:;opcache.max_wasted_percentage=5
./cli/php.ini.ucf-dist:;opcache.use_cwd=1
./cli/php.ini.ucf-dist:;opcache.validate_timestamps=1
./cli/php.ini.ucf-dist:;opcache.revalidate_freq=2
./cli/php.ini.ucf-dist:;opcache.revalidate_path=0
./cli/php.ini.ucf-dist:;opcache.save_comments=1
./cli/php.ini.ucf-dist:;opcache.enable_file_override=0
./cli/php.ini.ucf-dist:;opcache.optimization_level=0xffffffff
./cli/php.ini.ucf-dist:;opcache.inherited_hack=1
./cli/php.ini.ucf-dist:;opcache.dups_fix=0
./cli/php.ini.ucf-dist:;opcache.blacklist_filename=
./cli/php.ini.ucf-dist:;opcache.max_file_size=0
./cli/php.ini.ucf-dist:;opcache.consistency_checks=0
./cli/php.ini.ucf-dist:;opcache.force_restart_timeout=180
./cli/php.ini.ucf-dist:;opcache.error_log=
./cli/php.ini.ucf-dist:;opcache.log_verbosity_level=1
./cli/php.ini.ucf-dist:;opcache.preferred_memory_model=
./cli/php.ini.ucf-dist:;opcache.protect_memory=0
./cli/php.ini.ucf-dist:;opcache.restrict_api=
./cli/php.ini.ucf-dist:;opcache.mmap_base=
./cli/php.ini.ucf-dist:;opcache.file_cache=
./cli/php.ini.ucf-dist:;opcache.file_cache_only=0
./cli/php.ini.ucf-dist:;opcache.file_cache_consistency_checks=1
./cli/php.ini.ucf-dist:; Implies opcache.file_cache_only=1 for a certain process that failed to
./cli/php.ini.ucf-dist:;opcache.file_cache_fallback=1
./cli/php.ini.ucf-dist:;opcache.huge_code_pages=1
./cli/php.ini.ucf-dist:;opcache.validate_permission=0
./cli/php.ini.ucf-dist:;opcache.validate_root=0
./cli/php.ini.ucf-dist:;opcache.opt_debug_level=0
./apache2/php.ini:zend_extension = /usr/lib/php/20170718/opcache.so
./apache2/php.ini:[opcache]
./apache2/php.ini:opcache.enable=1
./apache2/php.ini:;opcache.enable_cli=0
./apache2/php.ini:opcache.memory_consumption=128
./apache2/php.ini:;opcache.interned_strings_buffer=8
./apache2/php.ini:opcache.max_accelerated_files=10000
./apache2/php.ini:;opcache.max_wasted_percentage=5
./apache2/php.ini:opcache.use_cwd=1
./apache2/php.ini:opcache.validate_timestamps=1
./apache2/php.ini:opcache.revalidate_freq=60
./apache2/php.ini:;opcache.revalidate_path=0
./apache2/php.ini:opcache.save_comments=1
./apache2/php.ini:opcache.enable_file_override=0
./apache2/php.ini:;opcache.optimization_level=0xffffffff
./apache2/php.ini:;opcache.inherited_hack=1
./apache2/php.ini:;opcache.dups_fix=0
./apache2/php.ini:;opcache.blacklist_filename=
./apache2/php.ini:;opcache.max_file_size=0
./apache2/php.ini:;opcache.consistency_checks=0
./apache2/php.ini:;opcache.force_restart_timeout=180
./apache2/php.ini:;opcache.error_log=
./apache2/php.ini:;opcache.log_verbosity_level=1
./apache2/php.ini:;opcache.preferred_memory_model=
./apache2/php.ini:;opcache.protect_memory=0
./apache2/php.ini:;opcache.restrict_api=
./apache2/php.ini:;opcache.mmap_base=
./apache2/php.ini:;opcache.file_cache=
./apache2/php.ini:;opcache.file_cache_only=0
./apache2/php.ini:;opcache.file_cache_consistency_checks=1
./apache2/php.ini:; Implies opcache.file_cache_only=1 for a certain process that failed to
./apache2/php.ini:;opcache.file_cache_fallback=1
./apache2/php.ini:;opcache.huge_code_pages=1
./apache2/php.ini:;opcache.validate_permission=0
./apache2/php.ini:;opcache.validate_root=0
./apache2/php.ini:;opcache.opt_debug_level=0
./apache2/php.ini.ucf-dist:[opcache]
./apache2/php.ini.ucf-dist:;opcache.enable=1
./apache2/php.ini.ucf-dist:;opcache.enable_cli=0
./apache2/php.ini.ucf-dist:;opcache.memory_consumption=128
./apache2/php.ini.ucf-dist:;opcache.interned_strings_buffer=8
./apache2/php.ini.ucf-dist:;opcache.max_accelerated_files=10000
./apache2/php.ini.ucf-dist:;opcache.max_wasted_percentage=5
./apache2/php.ini.ucf-dist:;opcache.use_cwd=1
./apache2/php.ini.ucf-dist:;opcache.validate_timestamps=1
./apache2/php.ini.ucf-dist:;opcache.revalidate_freq=2
./apache2/php.ini.ucf-dist:;opcache.revalidate_path=0
./apache2/php.ini.ucf-dist:;opcache.save_comments=1
./apache2/php.ini.ucf-dist:;opcache.enable_file_override=0
./apache2/php.ini.ucf-dist:;opcache.optimization_level=0xffffffff
./apache2/php.ini.ucf-dist:;opcache.inherited_hack=1
./apache2/php.ini.ucf-dist:;opcache.dups_fix=0
./apache2/php.ini.ucf-dist:;opcache.blacklist_filename=
./apache2/php.ini.ucf-dist:;opcache.max_file_size=0
./apache2/php.ini.ucf-dist:;opcache.consistency_checks=0
./apache2/php.ini.ucf-dist:;opcache.force_restart_timeout=180
./apache2/php.ini.ucf-dist:;opcache.error_log=
./apache2/php.ini.ucf-dist:;opcache.log_verbosity_level=1
./apache2/php.ini.ucf-dist:;opcache.preferred_memory_model=
./apache2/php.ini.ucf-dist:;opcache.protect_memory=0
./apache2/php.ini.ucf-dist:;opcache.restrict_api=
./apache2/php.ini.ucf-dist:;opcache.mmap_base=
./apache2/php.ini.ucf-dist:;opcache.file_cache=
./apache2/php.ini.ucf-dist:;opcache.file_cache_only=0
./apache2/php.ini.ucf-dist:;opcache.file_cache_consistency_checks=1
./apache2/php.ini.ucf-dist:; Implies opcache.file_cache_only=1 for a certain process that failed to
./apache2/php.ini.ucf-dist:;opcache.file_cache_fallback=1
./apache2/php.ini.ucf-dist:;opcache.huge_code_pages=1
./apache2/php.ini.ucf-dist:;opcache.validate_permission=0
./apache2/php.ini.ucf-dist:;opcache.validate_root=0
./apache2/php.ini.ucf-dist:;opcache.opt_debug_level=0

sudo grep -r 'opcache' /etc/apache2/ returned no results

 

And just for kicks

/etc/php/7.2$ sudo grep -r 'opcache.so' .
./mods-available/opcache.ini:zend_extension=opcache.so
./apache2/php.ini:zend_extension = /usr/lib/php/20170718/opcache.so

 

14 minutes ago, matthewlswanson said:

And just for kicks


/etc/php/7.2$ sudo grep -r 'opcache.so' .
./mods-available/opcache.ini:zend_extension=opcache.so
./apache2/php.ini:zend_extension = /usr/lib/php/20170718/opcache.so

 

There's the problem. Your distro manages PHP extensions with the INI files, where opcache is enabled, but there's also a modification to your php.ini to load it again.

Open up php.ini and remove the zend_extension line. Then look nearby for other edits that also don't belong in that file.

  • Great Answer 1
23 hours ago, requinix said:

There's the problem. Your distro manages PHP extensions with the INI files, where opcache is enabled, but there's also a modification to your php.ini to load it again.

Open up php.ini and remove the zend_extension line. Then look nearby for other edits that also don't belong in that file.

I think you're right! That file it is pointing to no longer exists and I should comment it out. I will have to wait a couple weeks because this is finals week for our students and we absolutely cannot make changes on production until grading it done. I will keep this page up and comment when I am able to change it and confirm.

 

Thank you so much, you are a wizard!

  • 4 weeks later...
On 4/30/2020 at 1:59 PM, requinix said:

It no longer exists? I assume it existed when Apache was last restarted?

Correct, it's pointing to a file that must have been there years ago but is no longer there. Commenting out that line fixed the message from spamming us! Thank you so much!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.