Refreshing again and again shows error message - laravel

I was playing with Laravel by refreshing the page 10 times in a second and did this many times continuously. I got the below error
The only supported ciphers are AES-128-CBC and AES-256-CBC with the
correct key lengths.
This is a test case which can occur anytime by end user also. Is there any way to fix it?
I already have key in my env file. This issue occurs only when i refresh the page again and again,
I already checked the answer but could not help

As posted by one of the users at this issue at GitHub,
Under a heavy load of requests, two async requests are made, and during the second request the .env file is locked, so you receive the error only for that request.
To solve this, you can create a cache using below command, which will bypass your .env file on further requests.
php artisan config:cache

Run following command from application folder:
$ php artisan key:generate

First make the key if doesn't exists by running following command.
php artisan key:generate
Next clear your config cache.
php artisan config:clear
Propably application cached your config without app-key.

Related

Please how can I undo ''php artisan livewire:make product-ratings''

After running the command I realized that I don't want to use it again so I deleted the two components it created which are
CLASS: app/Http/Livewire/ProductRatings.php
VIEW: resources/views/livewire/product-ratings.blade.php
Now when I try to access my product in the frontend I get this error
include(C:\xampp\htdocs\keyi\vendor\composer/../../app/Http/Livewire/ProductRatings.php): Failed to open stream: No such file or directory
2 possibilities
You have actually deleted it but it still thinks its there so do php artisan view:clear
or
It seems like you are trying to access a Livewire component that has been deleted, but your application is still trying to include it. This is causing the error message "include(C:\xampp\htdocs\keyi\vendor\composer/../../app/Http/Livewire/ProductRatings.php): Failed to open stream: No such file or directory".
To resolve this issue, you will need to remove any references to the deleted Livewire component from your code. This could include removing references to it in your routes, controllers, views, or other parts of your application.
Once you have removed all references to the deleted component, you should be able to access your product in the frontend without encountering the error message. If you continue to have trouble, you may want to check your logs or run your application in debug mode to get more information about the problem.
Did you try livewire:delete
php artisan livewire:delete product-ratings
and run
php artisan cache:clear
php artisan config:clear
composer dump-autoload # if needed
saw this command in the web livewire:remove.(Not sure if exist)
php artisan livewire:remove product-ratings

127.0.0.1:8000 keeps on loading in a laravel project

I have a laravel project but when I use the command "php artisan serve" and type the url: http://127.0.0.1:8000/ , its just keep on loading without output nor error appear.
I solved this by running this command instead of PHP artisan serve.
php -S 127.0.0.1:8000 -t public/
Then try to load again 127.0.0.1:8000 in your browser.
Try disabling your anti-virus or check your firewall.
I disabled my Avast anti-virus and it's working fine for me now.
The port 8000 might be used by other in your computer. Try to change port by running in your project in cmd:
php artisan serve --port=1000
then type http://127.0.0.1:1000/ on your browser.
Run commands
php artisan config:clear
php artisan config:cache
Even after completing these steps, if Laravel is still showing error, check your_project/storage/logs/laravel.log.
Try these three commands for clearing cache config:
php artisan config:cache // clear config cache
php artisan config:clear // clear config cache
php artisan cache:clear // clear cache
php artisan optimize // To reoptimize the class loader
php artisan route:cache // clear route cache
php artisan view:clear // clear view cache
It sometimes happen because of too many redirection and also sometime because of middleware . so see your whole flow for that page.
Also see your cdn which included in your page because it take too many time if you have too many cdn and your connection is slow. And also try to clear all cache.
I experienced this problem also when I first launched out into Laravel.
Your port 8000 is most likely occupied by another service or program.
Simply go to your terminal where your project is open, and enter the following command
php artisan serve --port=1000
Then, return to your browser and enter the address, replacing 8000 with 1000, as in
127.0.0.1:1000
This worked for me.
There are several issues may be possible for that.
You have used CDN JS and CSS
Check you route/web.php
Check you log error log file storage/logs/laravel.log
Check above points this will sure give you positive result.
In my case I uninstalled Xampp and reinstalled it(I'm assuming you are using Xampp too).It worked for me.
If you are using xampp
just restart Apache and MySql

How to fix this error "Impossible to connect, please check your Algolia Application Id"?

I have everything correct, as written at laravel/algolia websites.
I tried to read lot of documentations and tutorials about Laravel Scout installation, but still can't find solution.
I have everything correct in my settings and also APIs are correct but still getting this error:
Impossible to connect, please check your Algolia Application Id.
I had the same issue (with Windows 10) and found this exception in the stack trace:
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
I found the solution for the error above in another StackOverflow post:
1) Download the latest cacert.pem from
https://curl.haxx.se/ca/cacert.pem
2) Add the following line to php.ini (if this is shared hosting and
you don't have access to php.ini then you could add this to .user.ini
in public_html)
curl.cainfo="/path/to/downloaded/cacert.pem"
Make sure you enclose the path within double quotation marks!!!
It solved my problem, Laravel Scout is working fine after that. Hope this will help someone.
Apparently on the issue came from on wrong credentials, this can occurs providing the wrong Application ID or Admin API Key. Also the correct way to provide the credential on scout.php is :
'algolia' => [
'id' => env('ALGOLIA_APP_ID', ''),
'secret' => env('ALGOLIA_SECRET', '')
],
And then fill your credentials in your .env file.
I'd recommend you to run php artisan config:clear in case you have cached your configuration (which you shouldn't do in dev env).
Let us know if it solve your issue.
I had the same issue and solved it like this
php artisan cache:clear
php artisan route:clear
php artisan config:clear or config:cache
My assumption is, because Laravel always creates a cache in the config, every time we change some config, there must be another config that is broken or an error due to the cache that was created earlier.
But I don't know for sure.
I share with you my experience.
System was Vagrant Homestead with VirtualBox in Windows 10.
command used in CMD:
php artisan scout:import "App\Post"
command failed with:
Impossible to connect, please check your Algolia Application Id.
Logged into virtual box with vagrant ssh and gave it another try.
That solved my problem.

Laravel stopped working locally, all artisan commands and composer commands will not work

I have been working on a project for about a month. There have been no major issues. We are about to launch.
An error was reported that a route was not working as intended on staging. I tried to replicate it locally by putting the route into my browser ( but obviously with the local domain path ) and it didnt work. this is the order of events:
that route was causing a permanent redirect. Code looked fine but i noticed the intended get did not seem to be hitting so I put a dd('test'); after it and refreshed and saw the test. So it was bypassing its intended route::get, which was not happening before.
I tried figuring this out, clearing cache and the normal things that could cause this. I then killed the server ( locally ) shut down terminal and restarted it, now everytime I try to run anything it responds with http://localhost
CO!!##!##!##:directoryproject username$ php artisan cache:clear
"http://localhost"
CO!!##!##!##:directoryproject username$ php artisan config:clear
"http://localhost"
CO!!##!##!##:directoryproject username$ php artisan serve
"http://localhost"
CO!!##!##!##:directoryproject username$
i cannot get anything to work. I tried checking out a different branch, nothing. Composer update, install nothing. I keep getting:
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 1
Any help would be greatly appreciated at this point.
You've likely got a dd statement somewhere like dd(request()->getHost()); or similar. Do a recursive search starting in the app's root directory for the pattern dd(. If that doesn't yield anything, start at the very top pulic/index.php and put in dd(__DIR__); statements and attempting to access the app. Then move onto the service providers, http kernel, etc. until you can locate the culprit code.

moving Laravel project between computers

I have been working on a laravel5 project on a computer , but now I want to continue on an other, but don't know how :(
I'm using wampserver and the project is in the "www" folder, this is the error I'm getting when trying to open the project: " Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request"
Your error message is very vague, so it is hard to pinpoint the cause. I assume you just copy pasted all of the project files
Try these steps:
Make sure you copy all of the project files including the hidden ones(.env).
Prepare your destination computer as in http://laravel.com/docs/
Check you have all the necessary PHP extensions available in php.ini as in above link requirements. Also, watch your PHP version!
Install composer https://getcomposer.org/doc/00-intro.md
When copied, go to your destination folder and run composer install.
Run php artisan key:generate from the command line.
Run php artisan cache:clear from command line
http://php.net/manual/en/install.windows.commandline.php
Make sure your webserver is serving pages from project/public folder.
If laravel is failing, check the log file to see the cause
your_project/storage/logs/laravel.log
Copy the project folder and navigate terminal/cmd
just run following commands.
Create database and place the same name at .env file in laravel project folder
1. composer install
2. php artisan key:generate
3. php artisan cache:clear
4. php artisan migrate
UPDATE: If you're getting
Whoops, looks like something went wrong
in app/config/app.php, set debugging as true with:
'debug' => env('APP_DEBUG', true)'
If you're getting the error
No supported encrypter found. The cipher and/or key length are invalid
for some people it worked to do cp .env.example .env before (2).
You would also have to create new storage link, because Laravel uses absolute path inside it.
php artisan storage:link
https://stackoverflow.com/a/32722141/3982831 Please follow this to resolve your problems. All people forget about permissions on folders.
After you have done as Ademord answer, you might need to use refresh to your WAMP, XAMP or any other development stack you are using. I had the same issue plus changes were not reflecting in the front end. For example new routes in the web.php were not updating.

Resources