RuntimeException ajax request laravel - php

I write a simple live chat converastion and works well, but in some cases,ajax request get error 500 (Internal Server Error) and the request is not complete
Record error in Laravel.log :
2017-02-28 16:49:54] production.ERROR: exception 'RuntimeException' with message 'The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.' in D:\wamp\www\***\vendor\laravel\framework\src\Illuminate\Encryption\Encrypter.php:43
application key was set,my ajax request works well,but in sometimes for example after 5-7 consecutive request this error occurs
where is the problem?

Application Key
The next thing you should do after installing Laravel is set your application key to a random string. If you installed Laravel via Composer or the Laravel installer, this key has already been set for you by the php artisan key:generate command.
Official Documentation

Related

php artisan serve command display error message

I am using php 7.3.2 on window 7. When I try to run php artisan serve, it shows this error on the webpage:
Whoops, looks like something went wrong.
Is it related to the message that I received when I want to migrate database, it says
Application In Production!
My error in laravel log shows
production.ERROR: RuntimeException: The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths. in C:\xampp\htdocs\Inventory\vendor\laravel\framework\src\Illuminate\Encryption\Encrypter.php:43
Following the error in your log file you seem to be missing your key attribute in your .env file. See this SO question for a solution.
To generate the secret key, run
$ php artisan key:generate
make sure to follow the official docs when installing Laravel.
Your laravel is running in production mode. If you are developing local, you should switch that for your local maschine.
To do so: In your .env set the APP_ENV to local (APP_ENV=local) and try again.
Now, you will see the full error message and you are able to handle it now.

Uploaded Laravel project on 000WebHost that's not working

I recently uploaded my laravel blog project on 000WebHost, after that I redirected to URL http://laravelcreativeblog.000webhostapp.com/, but I saw this error Whoops, looks like something went wrong., this error is displayed two times one after the other. So I googled that and finally I reached to the a solution that there is an error in APP_KEY which I found here /public_html/storage/logs/laravel.log and error at last is:
[2018-10-18 15:44:47] production.ERROR: No application encryption key
has been specified. {"exception":"[object] (RuntimeException(code: 0):
No application encryption key has been specified. at
/storage/ssd1/217/7530217/public_html/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:42)
[stacktrace]
So I generated Application Key from CMD by php artisan key:generate and put in the .ENV File but again getting that error.
This is all I done, so any suggestions???
I fixed the error the error was that 000WebHost does not support .ENV file variables, so we must add all .env detials into config/app.php file and database details into config/database.php. Read the last FAQ here, https://www.000webhost.com/forum/t/deploy-laravel-project-into-000webhost-site/127323 for more details(only for 000WebHost).
When you receive "No application encryption key" error:
be sure that you have .env file in root directory
run php artisan key:generate

Lumen isn't reading the app key if too many requests occur

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.

Laravel not working exception 'RuntimeException' with message 'No supported encrypter found

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.

Paypal Sandbox Access Token not Found in Cache

I am having a persisting issue with the Paypal access token for the sandbox environment where I continually get the error,
Client error: `POST https://api.sandbox.paypal.com/v1/payments/billing-
agreements` resulted in a `401 Unauthorized` response:
{"error":"invalid_token","error_description":"Access Token not found in cache"}
I am not sure where to go as this is a new token that is being generated and used just prior to running the API call. Everything was working normal until this began giving me issues a couple of nights ago. It seems to return this error for about 30 minutes or so until the token begins working. My issue is that once I switch to the live version, I do not want there to be this error while the new token is "processing" as the tokens are going to automatically update (or doing whatever the issue is).
Any suggestions?
The issue ended up being with Laravel's configuration caching from the env file. I just ran php artisan config:cache and it fixed itself. I added to the command
Artisan::call('config:cache');
and this fixed all of my issues.

Categories