5

Sometimes I like to use PHP's built-in development server to work on quick stuff like so:

php -S 127.0.0.1:8888

However I seem to run into heavy caching issues from time to time where I need to restart the server in order to see even simple HTML changes.

I haven't been able to find any options to disable this or otherwise pinpoint what might be causing this frustration.

Note: I usually have Chrome's Developer Tools open with browser caching disabled while I'm doing this. I don't think it's a browser caching issue.

Is there anything I can try?

Ryan Bosinger
  • 1,832
  • 2
  • 16
  • 25
  • Though it shouldn't be necessary if caching is disabled in the console, do you get a proper reload when you use `shift-F5`? – Michael Berkowski Aug 09 '14 at 21:33
  • Thanks for the suggestion Michael. I'm 99% certain it's not client-side caching as I've had enough experience with that. It might be possible that the PHP server is sending some aggressive cache headers though and making my browser behave differently that I'm used to. I'll check into that. – Ryan Bosinger Aug 10 '14 at 18:10

1 Answers1

2

If modifying your php scripts isn't resulting in a change, it could be a problem with opcode caching as opposed to browser caching (browser caching should be easily overridden by CTRL-F5 or CTRL-R, depending on your OS). This happens when the server is pre-compiling your php code to speed up responses.

This was the case with me, so I went in to /etc/php5/cli/conf.d/ and found the symlink to 05-opcache.ini and deleted that symlink, and restarted the builtin server. The problem where pages wouldn't change when I made edits to php code was resolved from that point onwards.

Kzqai
  • 22,588
  • 25
  • 105
  • 137