Friendifie
2 months ago
63
11
General

Are you also new? Is your .env showing?

Posted 2 months ago by Friendifie

Hi there LaraCasters, I'm still fairly new to Laravel (I'm a Lumen fan) but I've been a PHP Programmer for a pretty long time. I've been designing a very keen familiarity with the framework as time progresses. I just thought I'd share something I finally figured out that some others may be suffering from.

THE TUTORIALS ARE WRONG OR THEY'VE HAD AN UPDATE!

In order for us to post our APIs we were taught to remove the /public and move it into the / for it to work. Which is true sorta.

Apparently now my web-host (cPanel distributions) now work well with Laravel so it'll render it perfectly.

What I did is set my API's sub-domain name api.example.com to have my APIs /public as the Document Root and now it renders perfectly fine. Meaning, it pushes us out of the / directory (because we're one level down into the /public directory) which also now prevents anyone from accessing our .env file like api.example.com/.env and possibly obtaining our critical Database Login Credentials.

Just thought I'd share this for anyone else who's been having problems relating to Laravel/Lumen not operating correctly so we can all finally rest easily with less chance of errors now.

Apologies to the more advanced users, I'm just helping out more new users like myself who's been misguided by tutorials so we can all get things working correctly.

Please sign in or create an account to participate in this conversation.