Skip to content

PHP changes not taking immediate effect in local #156

Open

Description

@EvanK

After applying the provision playbook fix from #151 and bringing up a vm without varnish, @weeirishman was still seeing PHP script changes be actively ignored short of an apache restart.

Though he is still investigating and ruling out other possible causes, we suspect it was a side effect of PHP 5.5's opcache, in which case this may bypass it for local stages (diff updated):

diff --git a/lib/ansible/roles/php/tasks/main.yml b/lib/ansible/roles/php/tasks/main.yml
index 5903c06..6da6767 100644
--- a/lib/ansible/roles/php/tasks/main.yml
+++ b/lib/ansible/roles/php/tasks/main.yml
@@ -33,3 +33,8 @@
 - name:           Update php.ini's upload_max_filesize
   lineinfile:     dest=/etc/php5/apache2/php.ini backup=yes regexp='^[;# ]*upload_max_filesize' line='upload_max_filesize = 16M'
   sudo:           yes
+
+- name:           Update php.ini's opcache settings (on local stage only)
+  lineinfile:     dest=/etc/php5/apache2/php.ini backup=yes regexp='^[;# ]*opcache[.]{{ item.key }}' line='opcache.{{ item.key }} = {{ item.value }}'
+  with_dict:
+    revalidate_freq: 0
+    consistency_checks: 1
+  when:           'local' == stage
+  sudo:           yes

Once he confirms this is an opcache issue, I'll apply the above as a PR and get it tagged + released

Activity

  1. weeirishman commented on Dec 1, 2016

    @weeirishman
    Contributor

    This patch worked for me 98% of the time initially. There were still a few refreshes that didn't bring in the changes. Then after a few hours it got as bad as ever.

    This morning I changed the following line in /etc/php5/apache2/php.ini:

    opcache.enable=0 - previously commented out. Now things are running better again, but I don't know if that's from the Apache restart I had to do to get the php.ini changed picked up.

    Will report back after a few hours.

  2. EvanK commented on Dec 1, 2016

    @EvanK
    ContributorAuthor

    @weeirishman You may want to try opcache.consistency_checks=1 in combination with revalidate_freq (rather than disabling opcache altogether), to see if that addresses the caching issues...

    It will affect performance a bit, but that's to be expected for a dev environment, and should still be more performant than turning off opcache

  3. EvanK commented on Jan 4, 2017

    @EvanK
    ContributorAuthor

    Was there any update on this?

  4. weeirishman commented on Jan 4, 2017

    @weeirishman
    Contributor

    Yes sorry, I gave that a shot and it was substantially better, but I still had issues throughout the day. Not enough to say it was every X refreshes, but it was not as solid as disabling. I went back to working with it disabled and have had no issues since.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions