我的脚本中有 PhpAmqpLib 错误:
[PhpAmqpLib\Exception\AMQPRuntimeException]
Error Connecting to server (13): Permission denied (13)
我这样使用它:
$r = new PhpAmqpLib\Connection\AMQPConnection(
'localhost',
5672,
'guest',
'guest'
);
我尝试了很多事情,例如:
1)编辑iptables并重新启动它:
-A INPUT -p tcp -m tcp --dport 5672 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 5673 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 15672 -j ACCEPT
2) 尝试检查 SELinux
semanage port -a -t http_port_t -p tcp 5672
/usr/sbin/semanage: Port tcp/5672 already defined
semanage port -l | grep 5672
amqp_port_t tcp 5671, 5672
amqp_port_t udp 5671, 5672
3)再次删除和安装erlang和rabbitmq
但这没有帮助。
Rabbitmq 管理插件工作,我可以在这里显示信息:127.0.0.1:15672
Rabbitmq 服务器也处于活动状态。
rabbitmqctl status
Status of node rabbit@template ...
[{pid,30914},
{running_applications,
[{rabbitmq_management,"RabbitMQ Management Console","3.1.5"},
{rabbitmq_management_agent,"RabbitMQ Management Agent","3.1.5"},
{rabbit,"RabbitMQ","3.1.5"},
{os_mon,"CPO CXC 138 46","2.2.7"},
{rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.1.5"},
{webmachine,"webmachine","1.10.3-rmq3.1.5-gite9359c7"},
{mochiweb,"MochiMedia Web Server","2.7.0-rmq3.1.5-git680dba8"},
{xmerl,"XML parser","1.2.10"},
{inets,"INETS CXC 138 49","5.7.1"},
{mnesia,"MNESIA CXC 138 12","4.5"},
{amqp_client,"RabbitMQ AMQP Client","3.1.5"},
{sasl,"SASL CXC 138 11","2.1.10"},
{stdlib,"ERTS CXC 138 10","1.17.5"},
{kernel,"ERTS CXC 138 10","2.14.5"}]},
{os,{unix,linux}},
{erlang_version,
"Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8] [async-threads:30] [kernel-poll:true]\n"},
{memory,
[{total,32290312},
{connection_procs,5408},
{queue_procs,5408},
{plugins,435992},
{other_proc,9264648},
{mnesia,59976},
{mgmt_db,48480},
{msg_index,34160},
{other_ets,1110280},
{binary,29664},
{code,17472749},
{atom,1567425},
{other_system,2256122}]},
{vm_memory_high_watermark,0.4},
{vm_memory_limit,13149895065},
{disk_free_limit,1000000000},
{disk_free,2567311360},
{file_descriptors,
[{total_limit,924},{total_used,3},{sockets_limit,829},{sockets_used,1}]},
{processes,[{limit,1048576},{used,199}]},
{run_queue,0},
{uptime,1099}]
...done.
我使用 Red Hat Enterprise Linux Server 6.5 版。
也许有人知道问题的原因是什么?
ps我通过使用解决了这个问题:
/usr/sbin/setsebool httpd_can_network_connect=1