Featured image of post Macにphp-amqpをインストールする

Macにphp-amqpをインストールする

Twitter ツイート Hatena Bookmark ブックマーク

BigSurなMacにPHP7.4の環境の構成に php-amqpを入れた見聞録です。 きっかけはsymfony/messengerコンポーネントでキューの処理にRabbitMQを使おうとしたらphp-amqpが必要だと言われたことでした。

librabbitmqを入れる

brewで入れます。

1
$ brew install rabbitmq-c

php-amqpを入れる

peclで入れました。

1
$ pecl install php-amqp

途中でSet the path to librabbitmq install prefix [autodetect]  と librabbitmqのパスを求められますのでlibrabbitmqのパスを指定します。
私の環境では /opt/homebrew/opt/rabbitmq-c でした。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
build/libtool.m4:1184: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2809: _LT_AC_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:2808: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:1917: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:70: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:52: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:39: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
Set the path to librabbitmq install prefix [autodetect] :  /opt/homebrew/opt/rabbitmq-c

これで少し待つとインストール完了します。

インストールできたか確認する

1
2
3
$ php -m
[PHP Modules]
amqp
comments powered by Disqus
Built with Hugo
テーマ StackJimmy によって設計されています。