在 macOS 上安装 php amqp 扩展失败

时间:2021-05-07 18:06:29

标签: php

我的 PHP 版本是 8.0。

当我尝试安装 amqp 扩展时,我是这样做的:

# This is required because it seems apple dropped openssl ...
export PKG_CONFIG_PATH='$PKG_CONFIG_PATH:/usr/local/Cellar/rabbitmq-c/0.11.0/lib/pkgconfig:/usr/local/opt/openssl@1.1/lib/pkgconfig'
pecl install amqp

结果是这样的:

In file included from /private/tmp/pear/temp/amqp/amqp.c:43:
In file included from /private/tmp/pear/temp/amqp/php_amqp.h:54:
/private/tmp/pear/temp/amqp/amqp_connection_resource.h:38:73: error: expected ')'
void php_amqp_prepare_for_disconnect(amqp_connection_resource *resource TSRMLS_DC);
                                                                        ^
/private/tmp/pear/temp/amqp/amqp_connection_resource.h:38:37: note: to match this '('
void php_amqp_prepare_for_disconnect(amqp_connection_resource *resource TSRMLS_DC);
                                    ^
/private/tmp/pear/temp/amqp/amqp_connection_resource.h:62:142: error: expected ')'
int php_amqp_connection_resource_error(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *resource, amqp_channel_t channel_id TSRMLS_DC);
                                                                                                                                             ^
/private/tmp/pear/temp/amqp/amqp_connection_resource.h:62:39: note: to match this '('
int php_amqp_connection_resource_error(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *resource, amqp_channel_t channel_id TSRMLS_DC);
                                      ^
/private/tmp/pear/temp/amqp/amqp_connection_resource.h:63:181: error: expected ')'
int php_amqp_connection_resource_error_advanced(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *resource, amqp_channel_t channel_id, amqp_channel_object *channel TSRMLS_DC);
                                                                                                                                                                                    ^
/private/tmp/pear/temp/amqp/amqp_connection_resource.h:63:48: note: to match this '('
int php_amqp_connection_resource_error_advanced(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *resource, amqp_channel_t channel_id, amqp_channel_object *channel TSRMLS_DC);
                                               ^
/private/tmp/pear/temp/amqp/amqp_connection_resource.h:66:96: error: expected ')'
int php_amqp_set_resource_read_timeout(amqp_connection_resource *resource, double read_timeout TSRMLS_DC);
                                                                                               ^
/private/tmp/pear/temp/amqp/amqp_connection_resource.h:66:39: note: to match this '('
int php_amqp_set_resource_read_timeout(amqp_connection_resource *resource, double read_timeout TSRMLS_DC);
                                      ^
/private/tmp/pear/temp/amqp/amqp_connection_resource.h:67:98: error: expected ')'
int php_amqp_set_resource_write_timeout(amqp_connection_resource *resource, double write_timeout TSRMLS_DC);
                                                                                                 ^
/private/tmp/pear/temp/amqp/amqp_connection_resource.h:67:40: note: to match this '('
int php_amqp_set_resource_write_timeout(amqp_connection_resource *resource, double write_timeout TSRMLS_DC);
                                       ^
/private/tmp/pear/temp/amqp/amqp_connection_resource.h:70:94: error: expected ')'
int php_amqp_set_resource_rpc_timeout(amqp_connection_resource *resource, double rpc_timeout TSRMLS_DC);
                                                                                             ^
/private/tmp/pear/temp/amqp/amqp_connection_resource.h:70:38: note: to match this '('
int php_amqp_set_resource_rpc_timeout(amqp_connection_resource *resource, double rpc_timeout TSRMLS_DC);
                                     ^
/private/tmp/pear/temp/amqp/amqp_connection_resource.h:78:112: error: expected ')'
amqp_connection_resource *connection_resource_constructor(amqp_connection_params *params, zend_bool persistent TSRMLS_DC);
                                                                                                               ^
/private/tmp/pear/temp/amqp/amqp_connection_resource.h:78:58: note: to match this '('
amqp_connection_resource *connection_resource_constructor(amqp_connection_params *params, zend_bool persistent TSRMLS_DC);
                                                         ^
In file included from /private/tmp/pear/temp/amqp/amqp.c:43:
/private/tmp/pear/temp/amqp/php_amqp.h:378:147: error: expected ')'
int php_amqp_error(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *connection_resource, amqp_channel_resource *channel_resource TSRMLS_DC);
                                                                                                                                                  ^
/private/tmp/pear/temp/amqp/php_amqp.h:378:19: note: to match this '('
int php_amqp_error(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *connection_resource, amqp_channel_resource *channel_resource TSRMLS_DC);
                  ^
/private/tmp/pear/temp/amqp/php_amqp.h:379:176: error: expected ')'
int php_amqp_error_advanced(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *connection_resource, amqp_channel_resource *channel_resource, int fail_on_errors TSRMLS_DC);
                                                                                                                                                                               ^
/private/tmp/pear/temp/amqp/php_amqp.h:379:28: note: to match this '('
int php_amqp_error_advanced(amqp_rpc_reply_t reply, char **message, amqp_connection_resource *connection_resource, amqp_channel_resource *channel_resource, int fail_on_errors TSRMLS_DC);
                           ^
/private/tmp/pear/temp/amqp/php_amqp.h:384:144: error: expected ')'
void php_amqp_zend_throw_exception(amqp_rpc_reply_t reply, zend_class_entry *exception_ce, const char *message, PHP5to7_param_long_type_t code TSRMLS_DC);
                                                                                                                                               ^
/private/tmp/pear/temp/amqp/php_amqp.h:384:35: note: to match this '('
void php_amqp_zend_throw_exception(amqp_rpc_reply_t reply, zend_class_entry *exception_ce, const char *message, PHP5to7_param_long_type_t code TSRMLS_DC);
                                  ^
/private/tmp/pear/temp/amqp/php_amqp.h:385:97: error: expected ')'
void php_amqp_zend_throw_exception_short(amqp_rpc_reply_t reply, zend_class_entry *exception_ce TSRMLS_DC);
                                                                                                ^
/private/tmp/pear/temp/amqp/php_amqp.h:385:41: note: to match this '('
void php_amqp_zend_throw_exception_short(amqp_rpc_reply_t reply, zend_class_entry *exception_ce TSRMLS_DC);
                                        ^
In file included from /private/tmp/pear/temp/amqp/amqp.c:44:
/private/tmp/pear/temp/amqp/amqp_connection.h:28:67: error: expected ')'
void php_amqp_disconnect_force(amqp_connection_resource *resource TSRMLS_DC);
                                                                  ^
/private/tmp/pear/temp/amqp/amqp_connection.h:28:31: note: to match this '('
void php_amqp_disconnect_force(amqp_connection_resource *resource TSRMLS_DC);
                              ^
In file included from /private/tmp/pear/temp/amqp/amqp.c:45:
/private/tmp/pear/temp/amqp/amqp_basic_properties.h:29:57: error: expected ')'
void parse_amqp_table(amqp_table_t *table, zval *result TSRMLS_DC);
                                                        ^
/private/tmp/pear/temp/amqp/amqp_basic_properties.h:29:22: note: to match this '('
void parse_amqp_table(amqp_table_t *table, zval *result TSRMLS_DC);
                     ^
/private/tmp/pear/temp/amqp/amqp_basic_properties.h:30:78: error: expected ')'
void php_amqp_basic_properties_extract(amqp_basic_properties_t *p, zval *obj TSRMLS_DC);
                                                                             ^
/private/tmp/pear/temp/amqp/amqp_basic_properties.h:30:39: note: to match this '('
void php_amqp_basic_properties_extract(amqp_basic_properties_t *p, zval *obj TSRMLS_DC);
                                      ^
/private/tmp/pear/temp/amqp/amqp_basic_properties.h:33:90: error: expected ')'
void php_amqp_basic_properties_convert_to_zval(amqp_basic_properties_t *props, zval *obj TSRMLS_DC);
                                                                                         ^
/private/tmp/pear/temp/amqp/amqp_basic_properties.h:33:47: note: to match this '('
void php_amqp_basic_properties_convert_to_zval(amqp_basic_properties_t *props, zval *obj TSRMLS_DC);
                                              ^
/private/tmp/pear/temp/amqp/amqp_basic_properties.h:34:60: error: expected ')'
void php_amqp_basic_properties_set_empty_headers(zval *obj TSRMLS_DC);
                                                           ^
/private/tmp/pear/temp/amqp/amqp_basic_properties.h:34:49: note: to match this '('
void php_amqp_basic_properties_set_empty_headers(zval *obj TSRMLS_DC);
                                                ^
In file included from /private/tmp/pear/temp/amqp/amqp.c:47:
/private/tmp/pear/temp/amqp/amqp_channel.h:25:93: error: expected ')'
void php_amqp_close_channel(amqp_channel_resource *channel_resource, zend_bool check_errors TSRMLS_DC);
                                                                                            ^
/private/tmp/pear/temp/amqp/amqp_channel.h:25:28: note: to match this '('
void php_amqp_close_channel(amqp_channel_resource *channel_resource, zend_bool check_errors TSRMLS_DC);
                           ^
In file included from /private/tmp/pear/temp/amqp/amqp.c:48:
/private/tmp/pear/temp/amqp/amqp_envelope.h:25:83: error: expected ')'
void convert_amqp_envelope_to_zval(amqp_envelope_t *amqp_envelope, zval *envelope TSRMLS_DC);
                                                                                  ^
/private/tmp/pear/temp/amqp/amqp_envelope.h:25:35: note: to match this '('
void convert_amqp_envelope_to_zval(amqp_envelope_t *amqp_envelope, zval *envelope TSRMLS_DC);
                                  ^
/private/tmp/pear/temp/amqp/amqp.c:132:103: error: use of undeclared identifier 'TSRMLS_C'
        amqp_exception_class_entry = PHP5to7_zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C));
                                                                                                             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [amqp.lo] Error 1
ERROR: `make' failed

1 个答案:

答案 0 :(得分:1)

好的,明白了。 AMQP 扩展目前不是为 PHP 8.0 发布的稳定版本。这是由于 windows 下的一个 bug 仍然需要修复。这意味着你可以在 Linux 或 macOS 下安装 php-amqp。

为此,请使用以下命令:

export PKG_CONFIG_PATH='$PKG_CONFIG_PATH:/usr/local/Cellar/rabbitmq-c/0.11.0/lib/pkgconfig:/usr/local/opt/openssl@1.1/lib/pkgconfig'
pecl install amqp-1.11.0beta
相关问题