无法为 PHP 安装 AMQP - 找不到符号错误

发布于 2024-09-18 21:01:19 字数 1098 浏览 11 评论 0原文

运行下面列出的代码时,我收到以下错误。我已经通过 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

习惯成性 2024-09-25 21:01:19

确保 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文