Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jimmyhowedotcom's avatar

LV5 Environments on Hosting Server

Hey, pretty new to actually hosting websites, and just practicing my workflow etc... Whats the best way to set up the production environment on my host?

From what I can see you can set environment variables in the .env file... however, lets say i create a new Laravel app, I edit my local config in .env... then push to GitHub, then SSH into my hosting server and git pull... then there is no .env file there, obviously because .env files are ignored ... and I cant edit the Laravel config files as they would be published on GitHub...

So what do I do next? manually FTP a production .env file to the server? Or should I set environment variables on the server via ssh, or do I have to edit .htaccess files etc? and if so, how?

How do I go about setting this up?

0 likes
5 replies
toniperic's avatar

Yeah, either of those works.

To be consistent I would choose creating the .env file by myself on the production server.

samsoft's avatar

@bashy hosting laravel application on apache server, after following the instruction here http://laravel.io/forum/03-06-2015-how-to-setup-laravel-5-in-shared-hosting?page=1#reply-22311

but after i follow the instruction, it display internal server error... check below

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.

Please what can i do?

bashy's avatar

Check error logs, could be 1 of 1,000 things.

samsoft's avatar

I checked the logs but nothing was there... here is the folder structure
[laravel framework]
[css]
[fonts]
[js]
.htacess
.index.php
robots.txt

from my index.php, i have

require DIR.'/../[laravel framework]/bootstrap/autoload.php';
$app = require_once DIR.'/../[laravel framework]/bootstrap/app.php';

i'm feeling there was a mistake somewhere which i can;t identify... maybe from the include URL above. here is my .HTACESS information

Options -MultiViews RewriteEngine On # Redirect Trailing Slashes... RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

RewriteCond %{REQUEST_URI} !^
RewriteRule ^(.*)$ /$1 [L]

What can i do???

Please or to participate in this conversation.