###2018.03.15 rabbitmq-server-3.6.12的安装部署
# 检查是否已经安装旧版本的软件
[root@localhost src]# rpm -qa|grep erlang
[root@localhost src]# rpm -qa|grep rabbitmq
# 如果之前yum安装过rabbitmq可能会有旧版本的软件,需要卸载掉再安装
# yum remove erlang-R14B erlang-erts -y
# 配置rabbitmq所需要的yum源(epel源)
[root@localhost src]# rpm -Uvh http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
Retrieving http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
curl: (22) The requested URL returned error: 404 Not Found
error: skipping http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm - transfer failed
[root@localhost src]# rpm -Uvh http://download.Fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Retrieving http://download.Fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.nKc47n: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ################################# [100%]
package epel-release-7-11.noarch (which is newer than epel-release-6-8.noarch) is already installed
# 安装指定版本的rabbitmq
[root@localhost src]# wget http://www.rabbitmq.com/releases/erlang/erlang-19.0.4-1.el6.x86_64.rpm
--2018-03-15 03:26:57-- http://www.rabbitmq.com/releases/erlang/erlang-19.0.4-1.el6.x86_64.rpm
Resolving www.rabbitmq.com (www.rabbitmq.com)... 104.20.62.197, 104.20.63.197, 2400:cb00:2048:1::6814:3fc5, ...
Connecting to www.rabbitmq.com (www.rabbitmq.com)|104.20.62.197|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18585932 (18M) [application/x-redhat-package-manager]
Saving to: ‘erlang-19.0.4-1.el6.x86_64.rpm’
100%[==========================================================================================================================>] 18,585,932 760KB/s in 15s
2018-03-15 03:27:13 (1.17 MB/s) - ‘erlang-19.0.4-1.el6.x86_64.rpm’ saved [18585932/18585932]
[root@localhost src]# wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.12/rabbitmq-server-3.6.12-1.el6.noarch.rpm
--2018-03-15 03:27:41-- http://www.rabbitmq.com/releases/rabbitmq-server/v3.6.12/rabbitmq-server-3.6.12-1.el6.noarch.rpm
Resolving www.rabbitmq.com (www.rabbitmq.com)... 104.20.62.197, 104.20.63.197, 2400:cb00:2048:1::6814:3fc5, ...
Connecting to www.rabbitmq.com (www.rabbitmq.com)|104.20.62.197|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4964260 (4.7M) [application/x-redhat-package-manager]
Saving to: ‘rabbitmq-server-3.6.12-1.el6.noarch.rpm’
100%[==========================================================================================================================>] 4,964,260 674KB/s in 9.4s
2018-03-15 03:27:51 (517 KB/s) - ‘rabbitmq-server-3.6.12-1.el6.noarch.rpm’ saved [4964260/4964260]
[root@localhost src]# yum install erlang-19.0.4-1.el6.x86_64.rpm -y
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Examining erlang-19.0.4-1.el6.x86_64.rpm: erlang-19.0.4-1.el6.x86_64
Marking erlang-19.0.4-1.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package erlang.x86_64 0:19.0.4-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================================================
Installing:
erlang x86_64 19.0.4-1.el6 /erlang-19.0.4-1.el6.x86_64 32 M
Transaction Summary
====================================================================================================================================================================
Install 1 Package
Total size: 32 M
Installed size: 32 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : erlang-19.0.4-1.el6.x86_64 1/1
Verifying : erlang-19.0.4-1.el6.x86_64 1/1
Installed:
erlang.x86_64 0:19.0.4-1.el6
Complete!
[root@localhost src]# yum install rabbitmq-server-3.6.12-1.el6.noarch.rpm -y
# 启动rabbitmq
[root@localhost src]# service rabbitmq-server start
ps -ef|grep rabbitmq
#配置开机自启动
chkconfig rabbitmq-server on
chkconfig --list rabbitmq-server
# 设置rabbitmq启用的功能
rabbitmq-plugins enable rabbitmq_management
service rabbitmq-server restart
# 默认的用户密码为guest,可以创建新的rabbitmq用户并授权
rabbitmqctl add_user admin 123456
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
可以访问:http://IP:15672
##安装amqp扩展
cd /usr/local/src/
wget -c https://pecl.php.net/get/amqp-1.9.3.tgz
tar zxvf amqp-1.9.3.tgz
wget -c https://github.com/alanxz/rabbitmq-c/releases/download/v0.8.0/rabbitmq-c-0.8.0.tar.gz
tar zxvf rabbitmq-c-0.8.0.tar.gz
[root@localhost src]# cd rabbitmq-c-0.8.0
[root@localhost rabbitmq-c-0.8.0]# ./configure --prefix=/usr/local/
bin/ etc/ games/ include/ lib/ lib64/ libexec/ memcache/ mongodb/ mysql/ nginx/ php/ sbin/ share/ src/
[root@localhost rabbitmq-c-0.8.0]# ./configure --prefix=/usr/local/rabbitmq-c-0.8.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: WARNING: Attempt c89 workaround for old versions of autoconf
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking if compiler accepts '-std=gnu90'... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.17... yes
checking for inline... inline
checking if compiler accepts '-Wall'... yes
checking if compiler accepts '-Wextra'... yes
checking if compiler accepts '-Wstrict-prototypes'... yes
checking if compiler accepts '-Wno-unused-function'... yes
checking if compiler accepts '-fno-common'... yes
checking if compiler accepts '-fvisibility=hidden'... yes
checking if linker accepts '-no-undefined'... no
checking for library containing getaddrinfo... none required
checking for library containing socket... none required
checking for library containing clock_gettime... none required
checking for library containing posix_spawnp... none required
checking if htonll is defined... no
checking for poll(2)... yes
checking for SSL... yes
checking for popt.h... no
checking for poptGetContext in -lpopt... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating librabbitmq.pc
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
rabbitmq-c build options:
Host: x86_64-unknown-linux-gnu
Version: 0.8.0
SSL/TLS: openssl
Tools: no
Documentation: no
Examples: yes
[root@localhost rabbitmq-c-0.8.0]# make && make install
make all-am
make[1]: Entering directory `/usr/local/src/rabbitmq-c-0.8.0'
CC librabbitmq/librabbitmq_librabbitmq_la-amqp_api.lo
CC librabbitmq/librabbitmq_librabbitmq_la-amqp_connection.lo
CC librabbitmq/librabbitmq_librabbitmq_la-amqp_consumer.lo
CC librabbitmq/librabbitmq_librabbitmq_la-amqp_framing.lo
CC librabbitmq/librabbitmq_librabbitmq_la-amqp_mem.lo
CC librabbitmq/librabbitmq_librabbitmq_la-amqp_socket.lo
CC librabbitmq/librabbitmq_librabbitmq_la-amqp_table.lo
CC librabbitmq/librabbitmq_librabbitmq_la-amqp_tcp_socket.lo
CC librabbitmq/librabbitmq_librabbitmq_la-amqp_time.lo
CC librabbitmq/librabbitmq_librabbitmq_la-amqp_url.lo
CC librabbitmq/librabbitmq_librabbitmq_la-amqp_hostcheck.lo
CC librabbitmq/librabbitmq_librabbitmq_la-amqp_openssl.lo
CC librabbitmq/librabbitmq_librabbitmq_la-amqp_openssl_hostname_validation.lo
CCLD librabbitmq/librabbitmq.la
CC examples/examples_libutils_la-utils.lo
CC examples/unix/examples_libutils_la-platform_utils.lo
CCLD examples/libutils.la
CC examples/amqp_bind.o
CCLD examples/amqp_bind
CC examples/amqp_consumer.o
CCLD examples/amqp_consumer
CC examples/amqp_connect_timeout.o
CCLD examples/amqp_connect_timeout
CC examples/amqp_exchange_declare.o
CCLD examples/amqp_exchange_declare
CC examples/amqp_listen.o
CCLD examples/amqp_listen
CC examples/amqp_listenq.o
CCLD examples/amqp_listenq
CC examples/amqp_producer.o
CCLD examples/amqp_producer
CC examples/amqp_rpc_sendstring_client.o
CCLD examples/amqp_rpc_sendstring_client
CC examples/amqp_sendstring.o
CCLD examples/amqp_sendstring
CC examples/amqp_unbind.o
CCLD examples/amqp_unbind
CC examples/amqps_bind.o
CCLD examples/amqps_bind
CC examples/amqps_connect_timeout.o
CCLD examples/amqps_connect_timeout
CC examples/amqps_consumer.o
CCLD examples/amqps_consumer
CC examples/amqps_exchange_declare.o
CCLD examples/amqps_exchange_declare
CC examples/amqps_listen.o
CCLD examples/amqps_listen
CC examples/amqps_listenq.o
CCLD examples/amqps_listenq
CC examples/amqps_producer.o
CCLD examples/amqps_producer
CC examples/amqps_sendstring.o
CCLD examples/amqps_sendstring
CC examples/amqps_unbind.o
CCLD examples/amqps_unbind
make[1]: Leaving directory `/usr/local/src/rabbitmq-c-0.8.0'
make[1]: Entering directory `/usr/local/src/rabbitmq-c-0.8.0'
/usr/bin/mkdir -p '/usr/local/rabbitmq-c-0.8.0/lib'
/bin/sh ./libtool --mode=install /usr/bin/install -c librabbitmq/librabbitmq.la '/usr/local/rabbitmq-c-0.8.0/lib'
libtool: install: /usr/bin/install -c librabbitmq/.libs/librabbitmq.so.4.2.0 /usr/local/rabbitmq-c-0.8.0/lib/librabbitmq.so.4.2.0
libtool: install: (cd /usr/local/rabbitmq-c-0.8.0/lib && { ln -s -f librabbitmq.so.4.2.0 librabbitmq.so.4 || { rm -f librabbitmq.so.4 && ln -s librabbitmq.so.4.2.0 librabbitmq.so.4; }; })
libtool: install: (cd /usr/local/rabbitmq-c-0.8.0/lib && { ln -s -f librabbitmq.so.4.2.0 librabbitmq.so || { rm -f librabbitmq.so && ln -s librabbitmq.so.4.2.0 librabbitmq.so; }; })
libtool: install: /usr/bin/install -c librabbitmq/.libs/librabbitmq.lai /usr/local/rabbitmq-c-0.8.0/lib/librabbitmq.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/php/bin:/usr/local/mysql/bin:/root/bin:/sbin" ldconfig -n /usr/local/rabbitmq-c-0.8.0/lib
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/rabbitmq-c-0.8.0/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
/usr/bin/mkdir -p '/usr/local/rabbitmq-c-0.8.0/include'
/usr/bin/install -c -m 644 librabbitmq/amqp.h librabbitmq/amqp_framing.h librabbitmq/amqp_tcp_socket.h librabbitmq/amqp_ssl_socket.h '/usr/local/rabbitmq-c-0.8.0/include'
/usr/bin/mkdir -p '/usr/local/rabbitmq-c-0.8.0/lib/pkgconfig'
/usr/bin/install -c -m 644 librabbitmq.pc '/usr/local/rabbitmq-c-0.8.0/lib/pkgconfig'
make[1]: Leaving directory `/usr/local/src/rabbitmq-c-0.8.0'
[root@localhost src]# cd amqp-1.9.3
[root@localhost amqp-1.9.3]# ll
total 404
-rw-r--r--. 1 root root 26214 Oct 19 09:51 amqp_basic_properties.c
-rw-r--r--. 1 root root 2109 Oct 19 09:51 amqp_basic_properties.h
-rw-r--r--. 1 root root 13625 Oct 19 09:51 amqp.c
-rw-r--r--. 1 root root 41242 Oct 19 09:51 amqp_channel.c
-rw-r--r--. 1 root root 1821 Oct 19 09:51 amqp_channel.h
-rw-r--r--. 1 root root 51694 Oct 19 09:51 amqp_connection.c
-rw-r--r--. 1 root root 1935 Oct 19 09:51 amqp_connection.h
-rw-r--r--. 1 root root 21874 Oct 19 09:51 amqp_connection_resource.c
-rw-r--r--. 1 root root 3934 Oct 19 09:51 amqp_connection_resource.h
-rw-r--r--. 1 root root 5623 Oct 19 09:51 amqp_decimal.c
-rw-r--r--. 1 root root 1734 Oct 19 09:51 amqp_decimal.h
-rw-r--r--. 1 root root 9821 Oct 19 09:51 amqp_envelope.c
-rw-r--r--. 1 root root 1814 Oct 19 09:51 amqp_envelope.h
-rw-r--r--. 1 root root 30297 Oct 19 09:51 amqp_exchange.c
-rw-r--r--. 1 root root 1719 Oct 19 09:51 amqp_exchange.h
-rw-r--r--. 1 root root 9744 Oct 19 09:51 amqp_methods_handling.c
-rw-r--r--. 1 root root 3367 Oct 19 09:51 amqp_methods_handling.h
-rw-r--r--. 1 root root 43802 Oct 19 09:51 amqp_queue.c
-rw-r--r--. 1 root root 1713 Oct 19 09:51 amqp_queue.h
-rw-r--r--. 1 root root 5077 Oct 19 09:51 amqp_timestamp.c
-rw-r--r--. 1 root root 1738 Oct 19 09:51 amqp_timestamp.h
-rw-r--r--. 1 root root 10866 Oct 19 09:51 amqp_type.c
-rw-r--r--. 1 root root 2548 Oct 19 09:51 amqp_type.h
-rw-r--r--. 1 root root 2859 Oct 19 09:51 benchmark.php
-rw-r--r--. 1 root root 3988 Oct 19 09:51 config.m4
-rw-r--r--. 1 root root 634 Oct 19 09:51 config.w32
-rw-r--r--. 1 root root 771 Oct 19 09:51 CREDITS
-rw-r--r--. 1 root root 3204 Oct 19 09:51 LICENSE
-rw-r--r--. 1 root root 5409 Oct 19 09:51 php5_support.h
-rw-r--r--. 1 root root 5267 Oct 19 09:51 php7_support.h
-rw-r--r--. 1 root root 15166 Oct 19 09:51 php_amqp.h
drwxr-xr-x. 2 root root 4096 Mar 19 04:30 stubs
drwxr-xr-x. 2 root root 8192 Mar 19 04:30 tests
[root@localhost amqp-1.9.3]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
[root@localhost amqp-1.9.3]# ./configure --with-php-config=/usr/local/php/
bin/ etc/ include/ lib/ php/ sbin/ var/
[root@localhost amqp-1.9.3]# ./configure --with-php-config=/usr/local/php/bin/php
php php-cgi php-config phpize
[root@localhost amqp-1.9.3]# ./configure --with-php-config=/usr/local/php/bin/php-c
php-cgi php-config
[root@localhost amqp-1.9.3]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/
bin/ games/ lib/ libexec/ mongodb/ nginx/ rabbitmq-c-0.8.0/ share/
etc/ include/ lib64/ memcache/ mysql/ php/ sbin/ src/
[root@localhost amqp-1.9.3]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-amqp --with-librabbitmq-dir=/usr/local/rabbitmq-c-0.8.0/
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local/php
checking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226
checking for PHP installed headers prefix... /usr/local/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for amqp support... yes, shared
checking for amqp... yes, shared
yes
checking for pkg-config... /usr/bin/pkg-config
checking for amqp files in default path... found in /usr/local/rabbitmq-c-0.8.0/
checking for librabbitmq version... 0.8.0
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
[root@localhost amqp-1.9.3]# make && make install
/bin/sh /usr/local/src/amqp-1.9.3/libtool --mode=compile cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp.c -o amqp.lo
mkdir .libs
cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp.c -fPIC -DPIC -o .libs/amqp.o
/bin/sh /usr/local/src/amqp-1.9.3/libtool --mode=compile cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_type.c -o amqp_type.lo
cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_type.c -fPIC -DPIC -o .libs/amqp_type.o
/bin/sh /usr/local/src/amqp-1.9.3/libtool --mode=compile cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_exchange.c -o amqp_exchange.lo
cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_exchange.c -fPIC -DPIC -o .libs/amqp_exchange.o
/bin/sh /usr/local/src/amqp-1.9.3/libtool --mode=compile cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_queue.c -o amqp_queue.lo
cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_queue.c -fPIC -DPIC -o .libs/amqp_queue.o
/bin/sh /usr/local/src/amqp-1.9.3/libtool --mode=compile cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_connection.c -o amqp_connection.lo
cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_connection.c -fPIC -DPIC -o .libs/amqp_connection.o
/bin/sh /usr/local/src/amqp-1.9.3/libtool --mode=compile cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_connection_resource.c -o amqp_connection_resource.lo
cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_connection_resource.c -fPIC -DPIC -o .libs/amqp_connection_resource.o
/bin/sh /usr/local/src/amqp-1.9.3/libtool --mode=compile cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_channel.c -o amqp_channel.lo
cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_channel.c -fPIC -DPIC -o .libs/amqp_channel.o
/bin/sh /usr/local/src/amqp-1.9.3/libtool --mode=compile cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_envelope.c -o amqp_envelope.lo
cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_envelope.c -fPIC -DPIC -o .libs/amqp_envelope.o
/bin/sh /usr/local/src/amqp-1.9.3/libtool --mode=compile cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_basic_properties.c -o amqp_basic_properties.lo
cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_basic_properties.c -fPIC -DPIC -o .libs/amqp_basic_properties.o
/bin/sh /usr/local/src/amqp-1.9.3/libtool --mode=compile cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_methods_handling.c -o amqp_methods_handling.lo
cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_methods_handling.c -fPIC -DPIC -o .libs/amqp_methods_handling.o
/bin/sh /usr/local/src/amqp-1.9.3/libtool --mode=compile cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_timestamp.c -o amqp_timestamp.lo
cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_timestamp.c -fPIC -DPIC -o .libs/amqp_timestamp.o
/bin/sh /usr/local/src/amqp-1.9.3/libtool --mode=compile cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_decimal.c -o amqp_decimal.lo
cc -I. -I/usr/local/src/amqp-1.9.3 -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/amqp-1.9.3/amqp_decimal.c -fPIC -DPIC -o .libs/amqp_decimal.o
/bin/sh /usr/local/src/amqp-1.9.3/libtool --mode=link cc -DPHP_ATOM_INC -I/usr/local/src/amqp-1.9.3/include -I/usr/local/src/amqp-1.9.3/main -I/usr/local/src/amqp-1.9.3 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/usr/local/rabbitmq-c-0.8.0//include -DHAVE_CONFIG_H -g -O2 -o amqp.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/local/src/amqp-1.9.3/modules amqp.lo amqp_type.lo amqp_exchange.lo amqp_queue.lo amqp_connection.lo amqp_connection_resource.lo amqp_channel.lo amqp_envelope.lo amqp_basic_properties.lo amqp_methods_handling.lo amqp_timestamp.lo amqp_decimal.lo -Wl,-rpath,/usr/local/rabbitmq-c-0.8.0//lib -L/usr/local/rabbitmq-c-0.8.0//lib -lrabbitmq
cc -shared .libs/amqp.o .libs/amqp_type.o .libs/amqp_exchange.o .libs/amqp_queue.o .libs/amqp_connection.o .libs/amqp_connection_resource.o .libs/amqp_channel.o .libs/amqp_envelope.o .libs/amqp_basic_properties.o .libs/amqp_methods_handling.o .libs/amqp_timestamp.o .libs/amqp_decimal.o -Wl,--rpath -Wl,/usr/local/rabbitmq-c-0.8.0/lib -Wl,--rpath -Wl,/usr/local/rabbitmq-c-0.8.0/lib -L/usr/local/rabbitmq-c-0.8.0//lib /usr/local/rabbitmq-c-0.8.0/lib/librabbitmq.so -Wl,-rpath -Wl,/usr/local/rabbitmq-c-0.8.0//lib -Wl,-soname -Wl,amqp.so -o .libs/amqp.so
creating amqp.la
(cd .libs && rm -f amqp.la && ln -s ../amqp.la amqp.la)
/bin/sh /usr/local/src/amqp-1.9.3/libtool --mode=install cp ./amqp.la /usr/local/src/amqp-1.9.3/modules
cp ./.libs/amqp.so /usr/local/src/amqp-1.9.3/modules/amqp.so
cp ./.libs/amqp.lai /usr/local/src/amqp-1.9.3/modules/amqp.la
PATH="$PATH:/sbin" ldconfig -n /usr/local/src/amqp-1.9.3/modules
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/src/amqp-1.9.3/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
#配置文件里添加一行extension = amqp.so
[root@localhost amqp-1.9.3]# vim /usr/local/php/lib/php.ini
#重启php和Nginx
/etc/init.d/php-fpm restart
/etc/init.d/nginx restart
##测试(此处参考https://segmentfault.com/a/1190000002963223):
#publish.php
<?php
/**
* test rabbitMQ
*/
$conn_args = array(
'host' => '192.168.121.131',
'port' => '5672',
'login' => 'admin',
'password' => 'admin',
'vhost' => '/',
);
// create connect
$conn = new AMQPConnection($conn_args);
if (!$conn->connect()) {
die("can not connect the broker!\n");
}
// 创建信道
$channel = new AMQPChannel($conn);
// 创建交换机
$exchange = new AMQPExchange($channel);
$exchange->setName("pang_exchange");
$exchange->setType(AMQP_EX_TYPE_DIRECT);//direct类型
$exchange->setFlags(AMQP_DURABLE);//持久化
$status = $exchange->declare(); // 声明
echo "exchange status:".$status."\n";
$message = 'Test MQ!';
$route = array('route1', 'route2');
error_log(date("c")."\t\n", 3, "time.log");
for($i = 0; $i < 100000; $i++){
echo "Send Message:".$exchange->publish($message.date("Y-m-d H:i:s"), $route[$i%2])."\n";
// sleep(1);
}
error_log(date("c")."\t\n", 3, "time.log");
#consume.php
<?php
$conn_args = array(
'host' => '192.168.121.131',
'port' => '5672',
'login' => 'admin',
'password' => 'admin',
'vhost' => '/',
);
// create connect
$conn = new AMQPConnection($conn_args);
if (!$conn->connect()) {
die("can not connect the broker!\n");
}
// 创建信道
$channel = new AMQPChannel($conn);
// 创建交换机
$exchange = new AMQPExchange($channel);
$exchange_name = "pang_exchange";
$exchange->setName($exchange_name);
$exchange->setType(AMQP_EX_TYPE_DIRECT);//direct类型
$exchange->setFlags(AMQP_DURABLE);//持久化
$exchange->declare(); // 声明
// 创建队列
$queue_name = 'p_queue';
$queue = new AMQPQueue($channel);
$queue->setName($queue_name);
$queue->setFlags(AMQP_DURABLE); // 持久化
$queue->declare();
// 绑定交换机与队列,并指定路由键
echo 'Queue Bind '.$queue->bind($exchange_name, 'route1')."\n";
echo 'Queue Bind '.$queue->bind($exchange_name, 'route2')."\n";
// 阻塞模式接收消息
echo "Message:\n";
$queue->consume('processMessage', AMQP_AUTOACK); // 自动ACK应答
$conn->disconnect();
/**
* 消费回调函数 处理消息
*/
function processMessage($envelope, $queue) {
$msg = $envelope->getBody();
echo date("c")."\t".$envelope->getRoutingKey()."\t\n processMessage:".$msg."\n"; // 处理消息
}