0
votes

I had made a custom artisan command. In homestead everything goes right, but when I execute the command on server it cant read environment variables. When I ssh the server and try php artisan external:import the connection timeouts cause of null env vars.

On artisan tinker env() function returns null.

How can I read env vars on server?

IMPORTANT: This server is part of AWS, so it does not have .env file.

1
AWS servers can have .env files, why is this a problem on your server?Kevin Schenkers
IT dept configure in this way. I cant deploy .env files.Javier Torron Diaz
You can't you will have to set those variables in config files or where ever you call env()lewis4u
Understood. Laravel takes the default settings from the config folder files, if no .env is in place. Do you have every needed setting in there? Not sure if your custom artisan command needs a DB for example.Kevin Schenkers
The envs are configured in server directly, in configuration files I have the env() function and I can get the vars on web. But not in command lineJavier Torron Diaz

1 Answers

1
votes

did you clear config cache already?

php artisan config:clear

i think env function did not work after you cached the config