ElMorin
542
4
Laravel

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

Posted 1 year ago by ElMorin

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!

Please sign in or create an account to participate in this conversation.