I was wondering if someone could help out.
I have run through the environment setup for Laravel 4 and it doesnt seem to be working.
In my MAMP setup, i created protected.dev host
In my Bootstrap->start.php i have my local url like so
$env = $app->detectEnvironment(array(
'local' => array('protected.dev')
));
I have created a 'local' directory in the app->config directory, copied over the standard database.php file and then modified the database.php file inside the 'local' directory.
When i try and show the site, i get the
Access denied for user 'root'@'localhost'
which is in the standard config->database.php file.
It doesnt seem to be detecting its a local environment for some reason.
Any help would be greatly appreciated.
Cheers,
In laravel 4, the enviroments are set by the machine name, not by the web server url.
To determine your hostname use the hostname terminal command.
Type hostname in your terminal (this works on linux and mac) and cut and paste the result in your start.php file in the local variable and it should work fine.
example:
angoru@angel-mountain:~$ hostname
angel-mountain
my start.php
$env = $app->detectEnvironment(array(
'local' => array('angel-mountain'), // Change this to your local machine hostname.
'staging' => array('your-staging-machine-name'),
'production' => array('your-production-machine-name'),
));
For more explanation: Environment Configuration
Laravel 4 doesn't rely on virtual host to detect the working environment any more. It now uses the machine's hostname to do it. So you need to change protected.dev
to your machine's hostname. On Linux, you can find out your machine's hostname by running the following command in the terminal:
hostname
More on this http://laravel.com/docs/configuration#environment-configuration
In environments with several developers each one may add its hostname to the 'local' array in start.php:
$env = $app->detectEnvironment(array(
'local' => array('user1-hostname','user2-hostname'), // Developers local hostnames
'staging' => array('your-staging-machine-name'),
'production' => array('your-production-machine-name'),
));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With