Search code examples
phplaravellaravel-5gnupgphp-extension

Laravel custom artisan command and php extension GnuPG not found


I am making my own command in Laravel and from my Command class I call controller method. Like this:

public function fire(\BankEmailController $bankEmailController)
{
    if($this->option('fetch')){
       $this->userInformResluts($bankEmailController->checkEmails());
    }
}

In checkEmails method I create new GnuPG class:

putenv('GNUPGHOME=/var/www/mbiuro/panel/.gnupg');
$gpg = new gnupg();

Calling the command prompt this error:

[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'gnupg' not found

Solution

  • Php CLI uses other php.ini settings which I was unaware. Activeting extension in

    /etc/php5/cli/php.ini 
    

    solved the problem. After this issue I had problem, with creating Laravel classes. It was connected with the old version of Laravel 5. Solution and the related question can be found here:

    Laravel 5: Using Cache:: or DB:: within the Console Kernel's schedule() function