php artisan serve command display error message - php

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.

Related

Why getting this error for Laravel JWT auth on heroku server

Getting this error when calling any api:
Argument 3 passed to Lcobucci\\JWT\\Signer\\Hmac::doVerify() must be an instance of Lcobucci\\JWT\\Signer\\Key, null given, called in /app/vendor/lcobucci/jwt/src/Signer/BaseSigner.php on line 44
I am using tymondesigns/jwt-auth with laravel for api authentication.
I tried running this php artisan optimize after generating jwt:secret
My laravel application is hosted on basic heroku server with pgsql
It's possible that you are getting this error when you uploaded the applications before implementing the JWT and re-uploaded directly without reuploading the .env file.
If this is the case, the simplest way to solve this adding the JWT key in your .env file :
Here an example:
JWT_SECRET=jghgvfuldMpw5i4039393939393372y98bEWumqd9ls7Uk8DEpr0gIhgftrf
Or create jwt key with the command :
php artisan jwt:secret
Don't forget to clear config after changing your environment :
php artisan config:clear
php artisan config:cache

Why does the payload invalid error appears?

enter image description hereenter image description hereI'm getting a payload invalid error for every artisan command:
![][2]
My application was working fine previously without any error, until I ran the app a few days ago on localhost and this error is shown.
You seem to have an old version of the views. Please, run the following commands and try again:
php artisan cache:clear
php artisan view:clear
The payload invalid issue arises when the blades are of different version and the vendor files are of different version.A simple solution is to copy all the content in your current page and then copy it inside a newly created blade with the same version as of the vendor files.

Laravel 5.2: Class log does not exist in /vendor/laravel/framework/src/Illuminate/Container/Container.php:734

I had to clear config and cache, I ran into the following exception :
PHP Fatal error: Uncaught ReflectionException: Class log does not exist in /html/project/bootstrap/cache/compiled.php:1355
I removed bootstrap/compiled.php and ran php artisan clear-compiled, Then the exception got changed a little bit.
Class log does not exist in /html/project/vendor/laravel/framework/src/Illuminate/Container/Container.php:734
Steps i took to solve it :
Checked env for spaces and syntax errors, Which had a blank space and i removed it, but still my php artisan commands are not working.
Ran composer update | Still not working
Some people associate the error with mbstring and php-mysql extensions which i both have.
Tried composer dumpautoload
What am i missing, How should be done ?
I think somewhere in your code there is a typo like this (note lowercase 'l'):
\log::info('test');
And that code is executed when artisan is executed, so, probably this is somewhere in your console commands, or maybe in some services used by console commands, or maybe some global configuration.
Anyhow, search for '\log::' or 'log::' (in top-level file without namespaces this would result in same error message), and you'll find it.

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

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.

Categories