evolution / wordpress

Rapidly create, develop, & deploy WordPress across multiple environments.
MIT License
200 stars 18 forks source link

PHP changes not taking immediate effect in local #156

Open EvanK opened 7 years ago

EvanK commented 7 years ago

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

weeirishman commented 7 years ago

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.

EvanK commented 7 years ago

@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

EvanK commented 7 years ago

Was there any update on this?

weeirishman commented 7 years ago

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.