无法为 PHP 安装 AMQP - 找不到符号错误
运行下面列出的代码时,我收到以下错误。我已经通过 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
I'm getting the following error when running the code listed below. I have install AMQP extension through PECL and it shows up fine in my php.ini file when I do phpinfo both from the command line and browser.
<?php
// amqp rabbitmq client test
// Create a connection
$cnn = new AMQPConnection();
exit();
?>
When trying to run that code I get this error:
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
These are the install instructions I followed:
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
确保 librabbitmq 编译为 32 位(如果 php 是 32 位)。
这对我有帮助。
要以 32 位进行编译,请在编译 librabbitmq 和 pecl amqp 扩展时使用 ./configure CFLAGS="-m32"。
make sure that librabbitmq is compiled as 32bit (if php is 32bit).
That helped for me.
To compile in 32 bit, use ./configure CFLAGS="-m32" when compiling librabbitmq and the pecl amqp extension.