运行下面列出的代码时出现以下错误。我已经通过 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