CedNet's avatar

Lumen Windows local dev bug (files not loading fast enough, or something)

EDIT: This is a Windows local dev issue. It does not happen on the production server (VPS, Linux).

I've changed an API from Slim to Lumen and when reloading the page continously I'm given errors from use of Cache.

This only occurs while passing result via a simple cache method in the base controller.

The Cache::get() part sometimes crash with:

Class 'Memcached' not found in \vendor\illuminate\cache\MemcachedConnector.php on line 52

And Cache::put() returns the Ooops (hidden error, but in log file:

Access denied for user ''@'localhost' to database 'forge'' in \vendor\illuminate\database\Connectors\Connector.php:47

This happens because the environment variables aren't loaded before the script executes, hence the system uses the default configs that's supplied in the Lumen vendor framework directory.

More Windows developers out there? I have a speed computer with i7 and SSD's. So it really shouldn't be that. More probably down to wampserver (easier for development sometimes, but maybe not now that issues like this arrises).

0 likes
7 replies
Kemito's avatar

@CedNet if it is important issue which needs to be fixed asap i think the fastest way is to make a issue in github repository. imo, it will be the fastest way.

Good luck!

bashy's avatar

Put the env vars in PHP directly? If you need it that fast, don't use a package like DotEnv to process them...

Kemito's avatar

Well. By reading 'edit'. This is was i thought of first. that is because you don`t have memcache and default session driver as well as cache driver is set to 'memcache'. I suggest you to use other options for cache/session on windows development or install/get working memache on Windows.

To be honest a lot of things are mentioned in docs. They seems like they are the same as laravel but they are not. There are notes which include situations like this.

@CedNet

CedNet's avatar

I should probably post an update to this and state that the only workaround so far is to move the config files out of the Lumen repo where the default configs are. And instead of passing variables via env() or getenv() it must be hardcoded. It's the only way so far that I reliably test and use the API. Kinda sucks.

Don't know if it's down to how Lumen is architectured, or wamp.

@TaylorOtwell maybe you can have a look?

bashy's avatar

How can the script load before getting the environment vars? Honest question but just wondering this for issues I may come upon...

Please or to participate in this conversation.