[ 
https://issues.apache.org/jira/browse/QPID-3027?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13491096#comment-13491096
 ] 

Paul Colby commented on QPID-3027:
----------------------------------

bq. Can you ping me in IRC

I tried that, but you were away... I suspect our timezone differences will make 
IRC tricky (I'm UTC+11 at the moment).  Let me know you're timezone and I'll 
see if I can workout a convenient time for chatting.

In the meantime, here's some basic ways you can test the PHP code.

h3. PHP Info
The first thing to check, is that the {{cqpid}} and {{cqmf2}} PHP modules are 
loaded by PHP.  The easiest way to do this is to run the following command: 

{{php -i}}

This will produce a whole lot of text output describing PHP's configuration and 
modules, etc.  If you pipe it to a command like {{less}}, and then search for 
{{cqmf2}}, you will see the following details that have been added by the 
{{cqmf2}} and {{cqpid}} modules:

{noformat}
cqmf2

SWIG Version => 2.0.8
Targeted PHP Version => 5.4.7 (5.4.7)
PHP Thread Safety => disabled
Compiler Version => gcc 4.7.2
Build Date => Nov  5 2012 02:53:38

cqpid

SWIG Version => 2.0.8
Targeted PHP Version => 5.4.7 (5.4.7)
PHP Thread Safety => disabled
Compiler Version => gcc 4.7.2
Build Date => Nov  5 2012 02:53:34
{noformat}

If that information is not present, then the module was not loaded (the 
{{install}} target should have created relevant {{/etc/php.d/cqpid.ini}} and 
{{/etc/php.d/cqmf2.ini}} files to load the module).  Such as:

{code:title=cqpid.ini}
; configuration for PHP Qpid module
extension=/usr/lib64/php/modules/cqpid.so
{code}

If you want some (slightly) prettier output, instead of running {{php -i}} you 
could setup a simple PHP webpage and run the {{phpinfo()}} function to see the 
same output as above, but in HTML tables instead.

h3. CLI Examples
Once the modules are loaded (should happen automatically if you do a {{make 
install}}), the next thing I do is run some of the PHP examples.

First, run a qpidd broker in one terminal:

{{qpidd --auth=no}}

Then, run some of the examples under 
{{qpid/cpp/bindings/qpid/examples/php/cli}} - these are PHP ports of the 
existing Qpid examples, so work the same way.

For example:

{code}
[paul@fepoch cli]$ php -f map_sender.php   # Will send a PHP associative array 
as a map message to the broker.
[paul@fepoch cli]$ php -f map_receiver.php # Will print_r the next message from 
the broker.
Array
(
    [colours] => Array
        (
            [0] => red
            [1] => green
            [2] => white
        )

    [id] => 987654321
    [name] => Widget
    [percent] => 0.99
    [uuid] => 773bb118-286c-435e-8948-71e57f9e2f97
)
[paul@fepoch cli]$
{code}

This example is particularly interesting since it shows the marshalling of 
different QVariant types from/to PHP types :)

h3. Web Example
There's also a very basic "hello world" web-based exmaple in 
{{qpid/cpp/bindings/qpid/examples/php/web}}.  To run that example, simply drop 
the PHP file into a directory being hosted by a webserver with PHP enabled.  It 
will present an HTML form allowing you to specify some basic broker parameters, 
and will then send/receive a message.

h3.  Unit Testing
I'm quite a fan of {{phpunit}} for PHP unit testing, so I'll create some PHP 
unit tests for this sometime.  Perhaps I'll create them as a separate diff 
though, since the above patch is already 70kB (and the PHP unit tests will not 
require any direct code linkage to the Qpid / PHP module source, so can be 
entirely independent).

h3. Other Issues
The other issue I see, is the requirement for a custom {{FindPHPDev}} CMake 
module.  I've begun talks on the CMake mailing list in hopes of getting the 
module included there.  Is this a blocker in the meantime?  There might 
(probably should) be a way to include the custom CMake module in the Qpid 
source / build tree for now, but this is not something I've looked into yet.

I look forward to chatting on IRC sometime.
                
> PHP binding of Qpid Messaging API
> ---------------------------------
>
>                 Key: QPID-3027
>                 URL: https://issues.apache.org/jira/browse/QPID-3027
>             Project: Qpid
>          Issue Type: New Feature
>          Components: C++ Client
>    Affects Versions: 0.8
>            Reporter: Paul Colby
>            Assignee: Darryl L. Pierce
>         Attachments: cqpid_php.20110220.diff, cqpid_php.20110301.diff, 
> cqpid_php.20110328.diff, cqpid_php.20110415.diff, cqpid_php.20120406.diff, 
> cqpid_php.20121105.diff, cqpid_php.20121105-qpid-0.19.diff, cqpid_php.diff, 
> FindPHPDev.cmake, Makefile
>
>
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to