[php] PHP Fatal error: Class 'AMQPConnection' not found


When using rabbitmq,

$this->conn = new AMQPConnection($conn_args);
$this->conn->connect();

 i got these errors

PHP Fatal error: Class 'AMQPConnection' not found

 

Here is the way to resolve it.

1. Install the librabbitmq library

  # Download the rabbitmq-c library @ version 0-9-1
  git clone git://github.com/alanxz/rabbitmq-c.git
  cd rabbitmq-c
  # Enable and update the codegen git submodule
  git submodule init
  git submodule update
  # Configure, compile and install
  autoreconf -i 
./configure --prefix=/var/share/software/rabbitmq-c
make && sudo make install

 

2. Install the amqp

wget http://pecl.php.net/get/amqp-1.2.0.tgz
tar zxvf amqp-1.2.0.tgz
cd amqp-1.2.0
phpize
./configure --with-php-config=/path/to/your/php-config --with-librabbitmq-dir=/var/share/software/rabbitmq-c
sudo make
sudo make install

 

 

Have fun with rabbitmq!


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM