/php-amqp

PHP AMQP Binding Library

Primary LanguageCOtherNOASSERTION

PHP AMQP bindings Build Status

Object-oriented PHP bindings for the AMQP C library (https://github.com/alanxz/rabbitmq-c)

Requirements:

Installation

Some systems has php-amqp extension in their repo or available via external repositories, so it is MAY be the preferable way to install.

If you want to stay on the bleeding edge and have the latest version, install it from PECL or compile from sources (follow PHP official docs instruction).

Documentation

stub files with accurate PHPDoc which may be also used in your IDE for code completion, navigation and documentation in-place.

How to report a problem

  1. First, search through the closed issues and stackoverflow.com.
  2. Submit an issue with short and definitive title that describe your problem
  3. Provide platform info, php interpreter version, SAPI mode (cli, fpm, cgi, etc) extension is used in, php-amqp extension version, librabbitmq version, make tools version.
  4. Description should provide information how to reproduce a problem (gist is the most preferable way to include large sources) in a definitive way. When special environment Vagrant may be in handy.
  5. If stack trace generated include it in full via gist or the important part (if you are definitely know what you are doing) directly in description.
Things to check before reporting a problem

Some of them, the list is not complete.

  1. You are running on correct machine in correct environment and you platform meet your application requirement.
  2. librabbimq installed and discoverable in your environment so php-amqp extension can load it.
  3. php-amqp extension present in system (find amqp.so or amqp.dll if you are on windows), it is loaded (php --ri amqp produced some info), and there are no underlying abstraction that MAY emulate php-amqp work.
  4. You has correct RabbitMQ credentials.
  5. You are using the latest php-amqp, librabbitm, RabbitMQ and sometimes PHP version itself. Sometimes your problem is already solved.
  6. Other extensions disabled (especially useful when PHP interpreter crashes and you get stack trace and segmentation fault).
Keeping track of the workers

It is a good practice to keep php processes (i.e workers/consumers) under control. Usually, system administrators write their own scripts which ask services about current status or performs some desired actions. Usually request is sent via UNIX signals.
Because amqp consume method is blocking, pcntl extension seems to be useless.

php-signal-handler extension uses signal syscall, so it will work even if blocking method was executed. Some use cases are presented on extension's github page and examples are available here.