Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Fatal error: Class 'AMQPConnection' not found

Tags:

php

rabbitmq

amqp

I've already seen this question. It suggests that AMQP PECL extension is not installed. However, I have successfully installed both RabbitMQ as well as built PECL AMQP extension. The following is the output of the phpinfo().

phpinfo() output displaying AMQP extension configurations

You can clearly see, AMQP is loaded correctly. However, when I try to establish a connection, it says PHP Fatal error: Class 'AMQPConnection' not found. Below is the code.

$connection = new AMQPConnection();

And here is the output.

user@ubuntu:~$ php repos/default/test.php
PHP Fatal error:  Class 'AMQPConnection' not found in /home/user/repos/default/test.php on line 5

Why this might happen? Any suggestions? Thank you.

like image 343
Eye Avatar asked Nov 20 '11 04:11

Eye


1 Answers

The problem is most likely that the CLI installation uses a different php.ini file than the web/Apache module and you need to add the extension to the CLI php.ini file as well. Where exactly that is depends on your platform.

like image 138
deceze Avatar answered Oct 02 '22 03:10

deceze