Laravel with php 7: No supported encrypter found - laravel

This question has been asked for many times, so let me list the steps I did on it:
Setting 'cipher' => 'AES-128-CBC', (original AES-256-CBC);
php artisan key:generate
pasting the new key to the .env file
but the error remains the same.
In phpinfo, mcrypt shows enabled, although there's no extension in httpd.conf. Some answers says that the extension is integrated with php 7.
The project is downloaded from git and installed with composer and npm, the .env file was sent from another developer.

Might be there is a problem with your mcrypt. You need to check whether mcrypt php extention is installed or not and it should be enabled.
on command prompt run php -m | grep mcrypt
if you couldn't find in your apache just install it.
https://www.myoddweb.com/2010/11/18/install-mcrypt-for-php-on-windows/ here is the link.

After performed last two steps from you listed into your problem, have you clear config cache?.
If not then you must run php artisan config:clear because Laravel caches all config data.
Also why you change cipher? if no reason, revert it with original and performed the steps again.
Might this work for you.

Related

Downloaded laravel project hangs on preloader when deployed on localhost

I'm trying to deploy a laravel project I have received onto my localhost but it hangs on the loading page and doesn't load the site.
I received the source code of a laravel project that was coded for me.
The deployed website on the shared hosting works properly, and I can also manipulate the files through my ftp access.
However, I'm trying to deploy the project on my localhost (as well as to migrate to a different shared hosting service).
I tried loading the server on wamp, homestead and with artisan serve, but all methods end up the same - the index.php seems to be loading, but is stuck eternally on the preloading .gif file and doesn't present the site.
the browser debugger is throwing a lot of javascript errors (see attached image)
I assume a have a config problem, but I can't locate it and I am unsure how to even locate & debug the issue.
I tried following these configuration steps:
1. changed .htaccess to generic laravel .htaccess (deleted cpanel related lines)
2. changed the .env to fit my wamp db / homestead db
3. composer install
4. composer update
5. php artisan key:generate
6. php artisan cache:clear
7. php artisan migrate
I also installed laravel-debugbar but it hasn't helped me out of the box, and I'm unsure where I need to try to catch the problem.
If anyone can give me pointers on how to understand my problem better, I would be very thankful.
Thanks in advance!
laravel bug
Double check your .env if all details are correct
Set APP_DEBUG=true in your .env file
Double check if your database exist and have data if you are using a database
Check if your host is added to /etc/hosts
Check if your host is added to apache/nginx config correctly
Try running these commands:
$ rm composer.lock package-lock.json
$ composer install
$ npm install
$ npm run dev
$ php artisan clear-compiled
$ php artisan optimize:clear
$ php artisan package:discover
$ php artisan storage:link
$ php artisan migrate:fresh && php artisan db:seed // optional!
Then clear browser cache to be safe.
Open web inspector to see if you can see any errors.
Open latest laravel log in storage/logs/ folder to debug.
If all fails, install laravel-debugbar and see if you can debug there.

Cannot update composer dependencies on putty

Good day, I would like to ask some help, had a problem on composer update.
Here is the picture
but when I check using php -v, it says the php version is 7.1.21.
I really don't know what to do.
Try php composer.phar update.
Your "composer" could be an alias and it's probably pointing to a php 7.0 installation. Check using alias composer

How to fix artisan? php artisan optimize throws a [ReflectionException]

First of all, this is the actual error in git bash :
php artisan optimize
[ReflectionException]
Class hash does not exist
None of my artisan command are actually working. Earlier today, it was. Since i'm using git, I tried to find in the code I change what could be the error. No success.
I'm using Laravel 5.4.36
php -v : PHP 7.1.9-1+ubuntu16.04.1+deb.sury.org+1
vagrant -v : Vagrant 2.0.0
Homestead version is 6.2.2
Homestead is installed on windows 10.
There is the list of step I tried to solve the problem.
1.composer dump-autoload -> FAILED at php artisan optimize
2.composer update -> FAILED at php artisan optimize
3. Check if Hash is present in config\app.php
'providers' => [
/*
* Laravel Framework Service Providers...
*/
....
Illuminate\Hashing\HashServiceProvider::class,
....
'aliases' => [
....
'Hash' => Illuminate\Support\Facades\Hash::class,
....
3.1 I look if this file exist : Illuminate\Support\Facades\Hash It exist.
3.2 I look if this file exist : Illuminate\Hashing\BcryptHasher It exist.
4. I runned sudo chgrp -R www-data storage bootstrap/cache and sudo chmod -R ug+rwx storage bootstrap/cache.
I don't think that step (4) really did something that could help to solve this problem...
5. Tried composer dump-autoload again... Still FAILED at php artisan optimize
6. I deleted the vendor document then run composer install FAILED at php artisan optimize
7. I tried to run php artisan optimize in the file located localy on my windows and also into the file into the virtual machine. I know that both file are linked, but I wanted to see if there was a problem with one of the machine.
So, now I can't use php artisan <command> and I don't know what to do/try. Can you please help me fixing this! It will be appreciate!
It seems PHP is trying to inject a class hash but isn't able to resolve it. However, notice that the error describes the class name in lowercase. As you pointed out yourself, you probably need Laravel's well-known Hash facade.
Since PHP namespacing is case-sensitive, I suggest you check your Git commits to recent additions/modifications referencing the uncapitalized version of the facade.

How to Uninstall Laravel?

I am facing fatal errors regarding Artisan. I think I couldn't install laravel complete due to slow internet. Now I want to remove Laravel from root and want to have fresh installation.
Can anyone help me?
if you have installed it globally you can simply remove it by composer global remove laravel/installer
If you have installed it via composer project you simply remove the directory.
Since I was looking all around how to uninstall packages and after reading tones
of documentations here's the short how-to uninstall a workbench package in Laravel
Remove package service provider from 'providers' array in app/config/app.php
Remove the package folder in workbench/
Run:
php composer.phar dump-autoload
php artisan clear-compiled
php artisan optimize
(optional) remove all related code using the package (you'll get errors about that)
or use composer global remove laravel/installer
For me, the command that actually did the trick was: composer global remove laravel/installer

Laravel 4 Class not found in bootstrap/compiled.php

I have created a new branch using Git, applied some updates to my code, checked out that branch on my staging server and I now can't run anything composer related.
I've added some new packages to composer.json which work on my development environment, but as soon as I try composer update on the staging environment I get class not found errors relating to the classes it's not yet downloaded.
I've tried
composer update
composer dump-autoload
php artisan clear-compiled
php artisan dump-autoload
php artisan optimize
But all result in the following error
PHP Fatal error: Class 'Artdarek\OAuth\OAuthServiceProvider' not found in
/var/www/sites/x/bootstrap/compiled.php on line 4321
Script php artisan clear-compiled handling the
pre-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Fatal error: Class 'Artdarek\OAuth\OAuthServiceProvider'
not found in /var/www/sites/x/bootstrap/compiled.php
on line 4321
What else can I try in order to get composer to download new files?
php artisan optimize --force
That command will re-generate /bootstrap/compiled.php
The --force arg is needed to re-generate the file when your environment is in debug mode.
I'm sure there is a more elegant way of dealing with this (and please accept any answer that provides that over this one) but this can probably be solved by deleting the entire vendor directory and running composer install again.
I know its not pretty but sometimes it's easier and quicker.
I had the exact same issue, which I solved by uploading the project again through filezilla to my server.
That doesn't solve the issues you are having with composer, however. Which begs the question: Assuming that you are working on a dedicated server, do you have composer installed globally in your server? If not you should still be able to do a php composer.phar update or just create an alias.
I might have misunderstood your question, and I realize that your question was asked a while back, but hopefully it will be helpful for someone else.

Resources