14

I have a pretty standard PHP file that I use with MAMP to replicate apache on my local machine.

But for some reason when I make a change to the php file, the changes are not reflected even when I hard refresh in Chrome (multiple times.)

Even simple changes to the HTML are not reflected.

I changed the Document Root, restarted Apache and made sure PHP wasn't running any cache extensions in MAMP.

Joe Isaacson
  • 4,012
  • 6
  • 30
  • 40
  • Mostly likely your not hitting the correct file with your browser. – Pitchinnate Oct 04 '13 at 17:51
  • I know it sounds like I am not hitting the right file, but I am. I make a change, refresh, and Chrome reflects that change. But if I make another change, and refresh, nothing happens in Chrome. It works once and craps out. – Joe Isaacson Oct 04 '13 at 18:01
  • I would take the browser out of the equation and use Terminal to do either a manual HTTP request with telnet or run `php -r 'echo file_get_contents('http:///');'` – webbiedave Oct 04 '13 at 18:24
  • Your not crazy I had a setup on a recent computer that did this. Restarting the server for file changes is the only thing that worked. Still trying to figure why it's happening. – asiammyself Oct 18 '13 at 03:04

2 Answers2

25

I just ran into this. I found the answer in another thread -- it's the OPcode caching, which you can disable by commenting out some lines in php.ini.

See: https://stackoverflow.com/a/19268769

enter image description here

Boken
  • 4,825
  • 10
  • 32
  • 42
wjdennen
  • 421
  • 4
  • 4
  • 1
    make sure you change the version of the php.ini in the /bin/php/php[VERSION} folder and not /conf/php[VERSION] folder. – Jason Lydon Dec 18 '13 at 22:24
  • I can't make this work for the 7.0.9 php version, changed both dev and production ini :( – adedoy Feb 08 '17 at 07:25
-2

You can also restart apache

sudo service apache2 restart

This should also reload your modified scripts.

Jeet
  • 1,030
  • 2
  • 10
  • 20