I am trying to deploy my laravel project on Heroku. In the deployment steps at https://devcenter.heroku.com/articles/getting-started-with-laravel , I am asked to set the 32 char APP KEY for the application
I am really confused, that should I use the already generated APP_KEY environment variable in the .env file which is something like this:
APP_KEY=base64:3784jZeQ333utc4G8NxL9o2v6r8ct4ffTrRzFsStHrm0=
But this string is not 32 chars long, and the example in the steps clearly shows a random 32 char string.
My env app key seems to be encryted.
I already tried using this env app key, but after deploying I get error: Whoops something went wrong.
-Should I have to use the SAME key as generated in .env file ?
I re-deployed my application again and used the entire base64 string of the .env file APP_KEY environment variable. It works fine now.
Related
I'm completly new to Symfony and tried the following guide: https://github.com/thecodingmachine/symfony-vuejs ... but without docker (I have a simple webspace, I can't use docker there).
Now I'm stuck right in the beginning, when calling composer install in the app root. I get the following message:
In EnvVarProcessor.php line 131:
Environment variable not found: "DATABASE_URL".
Well, that sounds easy, I have to setup an enviroment variable ... but I'm not using docker and I don't want to set up a temporarly variable in the shell. Few seconds of google helped me, that I can use .env for my problem like descriped here: https://symfony.com/doc/current/configuration.html#configuration-based-on-environment-variables
In the example project is already a .env file, so I extendet it by DATABASE_URL. But suddenly it is not taking that variable.
I'm working on a macbook with a simple apache/php setup without forther configuration.
What am I missing?
I want to integrate PGP encryption into my web application, after looking for what to use(extensions, libraries, etc.) I decided to go with the gnupg extension for php. Now, I do have a PGP key in one of my desktop folders and I've tried to use it's fingerprint as a string for addencryptkey, the error I receive is get_key failed which I don't understand why, my PGP key is valid.
There are two very similar questions on SO:
php gnupg get_key failed error ,
gnupg get_key failed in php ,
Based on these, I've updated my code somewhat to no success, here's what it currently looks like:
putenv("GNUPGHOME=/home/user/Desktop/Keys/.gnupg/");
$pgp = new gnupg();
$pgp->addencryptkey("F0E2DF9C82ECE67935171F4939D8599A923820D9");
echo $pgp->geterror();
In the folder specified in putenv, I have my public key saved in a .asc file. I can't see what the problem really is, unless it only works with keys stored on the server?
I just wanted to share my fix for this issue. Given that this is one of the more recent questions on this topic I thought it best to share it here.
At the time I was able to encrypt messages fine (PHP 7.4 with the GNUPG PECL extension).
To address the get_key_failed error, after setting up/importing my keys I copied my entire .gnupg directory to the root of my webserver (/var/www/html in my case) and updated its permissions so that it was accessible by the webserver.
putenv("GNUPGHOME=/var/www/html/.gnupg");
I assumed that this would fix it, however I then encountered a new error when attemping to decrypt a message:
Uncaught Exception: decrypt failed
The only way I could resolve this was by ensuring my key pair did not have a passphrase. Some comments on the PHP GNUPG docs suggest that that passphrase which is the second argument on adddecryptkey() is ignored regardless. However, in my case decryption only worked with a private key that didn't have a passphrase set.
This worked on my local instance (Ubuntu 18) and when deployed to an EC2 instance running Amazon Linux 2.
I am setting up laravel 5.4 application on 000webhost. And i keep on getting this error
"The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths"
I searched for answers on stackoverflow as well github pages and tried all the answers but couldn't work it out. I tried deleting .env file and generating key but didn't seems to work.
composer update
php artisan key:generate
php artisan config:cache
php artisan cache:clear
The base64 key as in APP_KEY exceeds 32 characters . I dont understands what is bugging the application
Run the command
php artisan key:generate
And then clear the config cache :-
php artisan config:clear
Please let me know in case of any queries.
Also please check in config/app.php
After key is generated it should not be :-
'key' => env('32charshere')
Rather than that it should be 'key' => 32charshere
Thanks
.env file is disabled for some reason in 000webhost which doesnt correspond to key value that is in config/app.php . So, i solved the problem in following way .
In config/app.php there is a line 'key' => env(APP_KEY) i altered the line as 'key'=>env(APP_KEY,'base64key').
Also in similar way your database may not work in 000webhost for which in same way you need to change the values of your database username, password and dbname as well as host in config/database.php same as above.
I am running lumen on my backend, and on the frontend I am using AJAX to make requests to the server every 5 seconds. At first the requests run fine, but after about 20 requests I get the following error:
The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.
In my .env file I have this:
APP_ENV=local
APP_DEBUG=true
APP_KEY=1jleJ3gqex79HZ39mP5nWgtX2u1HD8X1
What is causing this to happen and is there anyway to fix it?
One thing I read is that the file is getting locked and it isn't able to read the .env so it throws an error.
I am trying to put my laravel project "live" but I am failing. I will start at the begin I got a VPS installed a LAMP stack, installed composer and VSFTPD. Went to /var/www/html and did a git clone of my repo. Changed apache to point to the correct directory, chmoded the storage folder and finally went to my server in the browser and got greeted by 2 Whoops, looks like something went wrong. After that I decided to check storage/logs/laravel.log and saw the following error:
exception 'RuntimeException' with message 'No supported encrypter found. The cipher and / or key length are invalid.' in /var/www/html/laravel/bootstrap/cache/compiled.php:7658
and decided to do a php artisan key:generate and got this output Application key [base64:(key was here but removed it here for obvious reasons)] set successfully.. And checked again and got greeted by the same 2 Whoops, looks like something went wrong.
Right now i have no idea what to do anymore any help is greatly appreciated.
You should have the default cypher in config/app.php as 'AES-256-CBC'. It requires a 32 character string, but the default key is "SomeRandomString," which is only 16 characters.
Either you change the cypher to 'AES-128-CBC' that works well with 16 character key, or you generate a new 32 character string for the key.
Do 'php artisan key:generate' on the command line. This will generate the proper key for you.
Update: Cache compiled had issues and a php artisan clear-compiled fixed it.