Skip to content

Fatal error: Uncaught PhpAmqpLib\Exception\AMQPConnectionClosedException: Broken pipe or closed connection  #321

@Funny-dot

Description

@Funny-dot

why?
my service is localhost;
image

my codes:

use PhpAmqpLib\Message\AMQPMessage;

include_once './vendor/autoload.php';


//创建连接和channel
$connection = new AMQPStreamConnection('127.0.0.1', 5672, 'admin', 'admin','/',false,
    'PLAIN','','en_US',3,3,null,true,15,3);
$channel = $connection->channel();

$channel->queue_declare('hello', false, false, false, false);

$msg = new AMQPMessage('Hello World!');
$channel->basic_publish($msg, '', 'hello');

echo " [x] Sent 'Hello World!'\n";
$channel->close();
$connection->close();```


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions