Home > Enterprise >  php - "amqp" extension is not installed
php - "amqp" extension is not installed

Time:10-06

I have the following error:

You cannot use the "Symfony\Component\Messenger\Bridge\Amqp\Transport\Connection" as the "amqp" extension is not installed.

I am completely sure that I have already installed it. Also running php -m and composer check-platform-reqs shows amqp is installed. Also, I checked php.ini, I have it there. I tried to reinstall it via the following command, but didn't work: sudo apt install php7.4-amqp

I am using Ubuntu 20.04, php7.4 and symfony 4

Any idea?

CodePudding user response:

You are mixing between the different SAPIs in PHP.

PHP has multiple sapis. [ cli , apache2 and fpm ] is the most popular - mostly the only - sapis.

when you are enabling a php extensions in cli this will not means that it will be enabled with apache2 or fpm and versa-vice.

to fix you problem make sure that you are enabling your extension under the right sapi. due to your comment you are trying to load it in apache2 while you are enabling it in cli.

edit the /etc/php/7.4/apache2/php.ini or /etc/php/7.4/fpm/php.ini to enable it.

note that you will need to restart apache2 or fpm using

sudo service apache2 restart
// or with fpm
sudo service php7.4-fpm restart
  • Related