Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9165625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:57:00+00:00 2026-06-17T14:57:00+00:00

I am currently deploying a Laravel project on my shared hosting account. It is

  • 0

I am currently deploying a Laravel project on my shared hosting account. It is an open project and hosted on GitHub as a public repository. As a result I’m using dynamic variables set by an .htaccess file in my database.php configuration file for my production environment. This allows me to also update my deployment using a git pull command on my host which helps speed up work.

The database.php file has something similar to

$database = $_SERVER['DBNAME'];

$database_user = $_SERVER['DBUSER'];

This is much like what is done when deploying to PagodaBox & works perfectly fine for the application with all things functioning as expected in the browser, no complaints.

The problem I have is that artisan is unable to use these variables and will attempt instead to connect to the database using what I believe to empty variables when processing a migrate instruction. I get an error that artisan tried to connect to the databases with no password. I have been calling artisan using --env=production and have tested this but found that it will only work if the database.php file has the variables specified explicitly instead of as environment variables.

Is there a way of causing artisan to “see” these environment variables?


answers that have proved useful to me so far:

http://forums.laravel.io/viewtopic.php?pid=8455

and

Environment driven database settings in Laravel?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:57:02+00:00Added an answer on June 17, 2026 at 2:57 pm

    Because Artisan is a CLI PHP request – the request never hits the .htaccess file – and therefore your variables are never set.

    As a workaround – you could define the variables inside the artisan file itself on line 3 (just after the <?php)

    $_SERVER['DBNAME'] = 'test';
    $_SERVER['DBUSER'] = 'something';
    

    edit: I just noticed you said this is public hosted on github – so you wont want to include your username/password in the file? Maybe put the artisan file as part of the .gitignore group – so you dont push/pull that single file?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I am deploying my application to a shared hosting environment and code-first with
I'm currently working on deploying a asp.net website to a shared hosted environment, and
I am currently deploying a Rails application using Capistrano. Cap deploy:update_code usually works just
I am planning on deploying git for a project I am currently working on
We are currently deploying some applications on a glassfish 3.0.1 using a postgres database
Currently I'm in the process of deploying my ASP.net MVC 2 project on a
My team is currently using Authlogic for user authentication, which disables a user's account
I'm currently working on a project involved in deploying Windows 7 (configured to our
I am currently deploying my application built using RC of MVC ASP.NET on the
all! I'm currently working for a project involving deploying netbooks to the villages for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.