运行下面列出的代码时出现以下错误。我已经通过PECL安装了AMQP扩展,当我从命令行和浏览器进行phpinfo时,它在我的php.ini文件中显示正常。
<?php
// amqp rabbitmq client test
// Create a connection
$cnn = new AMQPConnection();
exit();
?>
尝试运行该代码时出现此错误:
dyld: lazy symbol binding failed: Symbol not found: _amqp_new_connection
Referenced from: /opt/local/lib/php/extensions/no-debug-non-zts-20090626/amqp.so
Expected in: flat namespace
dyld: Symbol not found: _amqp_new_connection
Referenced from: /opt/local/lib/php/extensions/no-debug-non-zts-20090626/amqp.so
Expected in: flat namespace
这些是我遵循的安装说明:
Download rabbitmq-c lib from: http://hg.rabbitmq.com/rabbitmq-c/ (.zip file)
Download codegen http://hg.rabbitmq.com/rabbitmq-codegen/summary (.zip file)
unzip rabbitmq-c
unzip codegen and put it into the rabbitmq-c lib and rename it codegen
cd into rabbitmq-c dir
autoreconf -i && ./configure && make && sudo make install
#install the amqp extension
sudo pecl install -f amqp
答案 0 :(得分:1)
确保librabbitmq编译为32位(如果php是32位)。 这对我有帮助。
要编译32位,在编译librabbitmq和pecl amqp扩展时使用./configure CFLAGS =“ - m32”。