Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

iamamirsalehi's avatar

BaconQrCode\Exception\RuntimeException You need to install the imagick extension to use this back end

Hi there,

I'm using composer require pragmarx/google2fa-laravel and composer require bacon/bacon-qr-code for google authenticator but I can not use them because I get the error below

BaconQrCode\Exception\RuntimeException
You need to install the Imagick extension to use this back end

I've installed Imagick but I really don't know what's going on! if you have any solution or any alternative package I'll appreciate it. thanks in advance.

0 likes
10 replies
tykus's avatar

Did you confirm that the extension is actually loaded?

php -m | grep imagick

and, in a test Route:

Route::get('test', fn () => phpinfo());
1 like
iamamirsalehi's avatar

@tykus thanks for the reply, I entered the first command and what I got was imagick but when I used the route I couldn't find imagick in the phpinfo

tykus's avatar

So the PHP CLI has imagick, but the web server PHP does not.

What web server are you using; you can restart Apache, or PHP-FPM as appropriate to see if that will enable the extension.

If that does not solve the issue, you need to check that the imagick extension is being loaded in the appropriate config file; check the phpinfo page for _Loaded Configuration File _ and ensure that the following is present and uncommented:

extension=imagick
imtiaze's avatar

Please follow this guide line. You will get the best solution of installing imagick extension in wampp

www.youtube.com/watch?v=bxI0qCW73AI

hsikander's avatar

Downgrading it to 1.0.3 will fix the problem. Update compose.json as below "simplesoftwareio/simple-qrcode": "^1.0.3"

and run composer update

kouroumapaul's avatar

I just found the solution for this issue without downgrading the package version

  • Install PHP module Imagick
  • Verify the installation php -m | grep imagick
  • Then restart Apache service
sudo apt install php7.4-imagick (if you are using php7.4 version)
php -m | grep imagick
sudo /etc/init.d/apache2 restart

It will work fine

2 likes
goliv's avatar

If you need a simple solution, it's much easier to use Google API

Please or to participate in this conversation.