I am building a project using Laravel. It was working fine on localhost, but when I upload it to the server (the server has comodo ssl installed), I receive the following er
You only type in console:
php artisan key:generate
And if your app.php not change this Key, change manually.
Next if you should then happen to get this error message:
[ErrorException]
file_get_contents(/path/to/my/project/.env): failed to open stream: No such file or directory
Then make a copy of the .env.example
file and try again:
cp .env.example .env
php artisan key:generate
Do you have all the necessary extensions installed on the server?
It could be that you're missing the OpenSSL extension. Also, do you have the key set in .env
file?
Try running:
php artisan key:generate
Answer: the 'cipher' => ''
was not set.
I managed to solve deployment to live Ubuntu server, here is all the steps
Ensure PHP >= 5.5.9
Ensure, OpenSSL, Mbstring, Tokenizer and mcrypt is installed.
To Install mcrypt in PHP (Ubuntu):
sudo apt-get install php5-mcrypt,
sudo php5enmod mcrypt
Make storage folder writable:
chmod -R 0777 storage
Make Apache use the Lavarel /public folder as home:
DocumentRoot /home/code2/public_html/Laravel-Project/public
<Directory "/home/code2/public_html/Laravel-Project/public”>
AllowOverride all
</Directory>
Major gotcha for me is FTP might not copy hidden files by default:
.env
and /public/.htaccess
need to be there!
After completing the tasks above, it worked on Ubuntu server
I just fix error.
Shift+Click
right mouse to "open commend window here" from your root project. "php artisan key:generate"
. config/app.php
like 'key' => env('APP_KEY', 'insert get 32 char key')
,//line number 81write in console php artisan key:generate
you will get message like: Application key [get 32 char key] set successfully.
replace app key in config/app.php
like 'key' => env('APP_KEY', 'insert get 32 char key'),//line number 81
Please make sure you have this requirements in your machine.
Then after install or updating your project by
composer update
After this you have--
.env.example
Make a duplicate and rename it to--
.env
and make changes according to your database configuration or any other modifications you need.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your db name
DB_USERNAME=username if any otherwise root
DB_PASSWORD= your password if not set leave blank
Finally generate your application key by--
php artisan key:generate
For Someone may be only last step is enough. But I have this problem every time I clone any laravel project. This whole step makes this with any hazard.