PHP CLI Errors after running drush command / php command
Warnings after running drush operation.
Currenty after running drush (or php) command the following errors sometimes appear:
Cannot load Zend OPcache - it was already loaded PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/apc.so' - /usr/lib/php/20151012/apc.so: undefined symbol: zif_apcu_store
I think it was fixed upstream earlier today https://github.com/geerlingguy/ansible-role-php/issues/125
Gotcha, I think @geerlingguy just wanted a ticket here to make sure it's tracked here. (This was added during the sprints). Is the OpCache message fixed by this as well?
@oxyc - There might be another error (the OPcache one) that is still persisting. Just wanted to make sure to squelch them at some point; Drush operations can start looking quite crazy.
Today after fresh build from master I've noticed following issue
Cannot load Zend OPcache - it was already loaded
comment for every triggered php command.
What I did to get rid of it was to delete link '@10-opcache.ini' from /etc/php/7.0/cli/conf.d as it duplicates '@05-opcache.ini'.
@netlooker - Yeah, see: https://github.com/geerlingguy/ansible-role-php/issues/127 — I'll try to find a way to update this upstream, or maybe we can fix via https://github.com/geerlingguy/ansible-role-php/blob/master/vars/Debian.yml#L31
php_opcache_conf_filename: 10-opcache.ini
That would fix it for now (in config.yml), assuming you delete the 05-opcache.ini file if using an existing Ubuntu 16.04 box.
I think this is now fixed by upstream changes in the php role:
vagrant@drupalvm:~$ php -v
PHP 7.0.4-7ubuntu2 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
vagrant@drupalvm:/var/www/drupalvm/drupal$ drush status
Drupal version : 8.1.0-dev
Site URI : http://default
(Notice the lack of annoying errors/messages).
This is still happening to me
Still happening here too but only when I changed vagrant_box to parallels/ubuntu-14.04.
@philippelabat and @danbohea - Hmm... what version of PHP are you installing?
I didn't touch the default php_version: "7.0".
PHP 7 as well
yeah, sadly it seems like I'm running into the same issue as well even after doing a
$ sudo ansible-galaxy install -r provisioning/requirements.yml --force
and
$ vagrant reload --provisionf
$ php -v
Cannot load Zend OPcache - it was already loaded
PHP 7.0.4-7ubuntu2.1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
Any ideas how to fix this? I have verified that my roles/geerlingguy.php/tasks/main.yml does have the following:
line 31
- name: Define php_opcache_conf_filename (Ubuntu 16.04).
set_fact:
php_opcache_conf_filename: "10-opcache.ini"
when: php_opcache_conf_filename is not defined and ansible_distribution_version == "16.04"
I've also tried adding this line directly to my config.yml
php_opcache_conf_filename: 10-opcache.ini
No dice.
UPDATE:
After doing a $ vagrant ssh and running $ ls -la /etc/php/7.0/cli/conf.d | grep opcache I could see two opcache files. Manually getting rid of the 05-opcache.ini and restarting did the trick.
$ m -rf /etc/php/7.0/cli/conf.d/05-opcache.ini
Obviously this is going to break the next time I do a reload or spin up a new vm so I need to find a more permanent solution.
Also, a follow up question is that I used to be able to, or at least I think I used to be able to, run the command
$ service php restart but that no longer works now with php7. I tried service php7.0-fpm restart and every derivative I could think of.
Are you re-provisioning the box? That wont be enough as the file is already present and the role wont delete it. You need to rebuild the box from scratch (or log in and delete it manually).
@oxyc ahhh - I think I've been bitten by that this at least a few times now. I can't seem to remember when a reload versus a reload --provision versus a destroy is necessary.
I'll try that now.
Obviously this is going to break the next time I do a reload or spin up a new vm so I need to find a more permanent solution.
Actually it should work for all future re-provisions as the file wont be re-created now that you have the latest version of the php role. It's just that if it was created once, the role update wont remove it. Unless it in fact is a bug.
$ service php restart but that no longer works now with php7. I tried service php7.0-fpm restart and every derivative I could think of.
service php7.0-fpm restart should work for the webserver. But for CLI usage (drush or just php -v) you don't even need to do that.
I can't seem to remember when a reload versus a reload --provision versus a destroy is necessary.
Yes it's a bit tricky :) In this case a re-provision wont work as the role created a duplicate file and the fix just corrected the filename. For maintenance reasons I assume none of geerlingguys ansible roles attempt to provide upgrade paths for bugfixes. If on the other hand the error was a line within the file (not a duplicate file), a re-provision would just recreate the file from scratch and therefore fix the bug without leftovers. If possible, the easiest path is just to destroy and do a fresh provision, but if that's not an option I think you just have to find the upstream github issue and try to understand it well enough so you can undo whatever the bug caused. Changes in filenames is probably the most common one.