1

I'm running into a vexing issue while developing a personal site in Craft. I have a new Craft 3 site, installed manually. I'm developing live on the server in a dev subdomain. My .env sets the site to "dev" mode.

It's been awhile since I've worked on a front-end; one thing that's been an issue is either Safari or Craft caches the CSS while I'm coding. To prevent the cache from loading I've used the "ignore the resource cache while loading resources" button in the Network pane of the Webkit inspector. A few times after reloading the page, I begin to get server errors. The server errors are yii exceptions for a missing template of internal_error.html, which suggests a server error and not a Craft error specifically.

I've searched through the logs and although I can see where Craft throws the exception, I can't see what is causing this. The headers on my network simply say that the main site URL is throwing a 404. My server log says:

[Thu Mar 12 11:29:11.886937 2020] [core:error] [pid 28286] [client xx.xxx.xx.xxx:xxxxx] End of script output before headers: index.php

Thinking this might be a permissions issue I started from scratch with a Composer-installed Craft. All was fine until I used the cache button on the Network pane again, and the errors returned.

If I change the mode to "production" from "dev," the errors go away, and as far as I can see no new error is created in the server or Craft log. So I can develop in production mode but I do find the dev mode useful.

I've manually cleared the cache from storage/runtime and cleared the generated files in cpresources. I've also cleared the cache from the backend admin when logged in via production mode. This doesn't have any effect.

I should add the only thing I haven't tried is to disable Safari's caches while running the site in production mode; if it's related I don't want to break the only method I have on working on the site.

Any help here is greatly appreciated!

1

If I change the mode to "production" from "dev," the errors go away, and as far as I can see no new error is created in the server or Craft log. So I can develop in production mode but I do find the dev mode useful.

It sounds like you're changing the environment variable ENVIRONMENT, e.g.:

ENVIRONMENT="dev"

This actually doesn't do much, it's just an arbitrary name for the environment that Craft is running in. You could call it fluffybunny and no one would mind. The only thing it affects is what settings might be used in you multi-environment config files like config/general.php.

I'd suggest reading over the Flat Multi-Environment Config for Craft CMS 3 article

Also for log file reading, the article Zen and the Art of Craft CMS Log File Reading may be useful as well.

| improve this answer | |
  • I am changing the ENVIRONMENT variable, but I guess I should clarify what it's doing is turning devMode off. My config/general.php is untouched from Craft's defaults, which sets devMode to "true" with an ENVIRONMENT set to "dev". – Roger Wilco Mar 15 at 2:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.