WyriHaximus / reactphp-child-process-messenger

MIT License
31 stars 14 forks source link

The examples do not work as expected #1

Closed oviniciuslara closed 8 years ago

oviniciuslara commented 8 years ago

I tried to run the script but it seems that it did not work, I used the example folder, tried all the scripts it ...

But the echo's of scripts didnt work, example:

$messenger->rpc(MessageFactory::rpc('format', [
        'unixTime' => time(),
    ]))->then(function ($formattedTime) {
        echo $formattedTime['formattedTime'], PHP_EOL; // not are called
    });

are a bug?

WyriHaximus commented 8 years ago

Hey running php ping.php on the messages examples will run the example and php time.php for the time format example. Just tested the examples to be sure and they work for me. How (what PHP version, and OS + Version) are you using it and what version of this package are you using?

oviniciuslara commented 8 years ago

@WyriHaximus First I apologize for bothering you, know it sucks but it's important to me.

I'll tell you what I did in order to run this script.

First I'm using Mac with Yosemite and XAMPP to the server in its latest available version, and I'm using the last package of this repository.

  1. I copied the entire repository for my htdocs
  2. We performed composer in the directory
  3. I run the following command line for all sample files (ping.php and time.php)

You can see my terminal and confirm what I did ..

Last login: Sun Nov 15 12:10:59 on ttys000
MacBook-Air-de-thebestclass:~ thebestclass$ cd /Applications/XAMPP/xamppfiles/htdocs 
MacBook-Air-de-thebestclass:htdocs thebestclass$ composer.phar install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
  - Installing doctrine/inflector (v1.0.1)
    Downloading: 100%         

  - Installing indigophp/hash-compat (v1.0.1)
    Downloading: 100%         

  - Installing evenement/evenement (v2.0.0)
    Loading from cache

  - Installing react/stream (v0.4.2)
    Downloading: 100%         

  - Installing react/event-loop (v0.4.1)
    Loading from cache

  - Installing react/child-process (v0.4.0)
    Loading from cache

  - Installing react/promise (v2.2.1)
    Loading from cache

  - Installing wyrihaximus/ticking-promise (1.5.0)
    Downloading: 100%         

  - Installing phake/phake (1.0.8)
    Loading from cache

  - Installing phpunit/php-token-stream (1.4.3)
    Downloading: 100%         

  - Installing symfony/yaml (v2.7.3)
    Downloading: 100%         

  - Installing sebastian/version (1.0.6)
    Loading from cache

  - Installing sebastian/exporter (1.0.2)
    Downloading: 100%         

  - Installing sebastian/environment (1.3.0)
    Downloading: 100%         

  - Installing sebastian/diff (1.3.0)
    Loading from cache

  - Installing phpunit/php-text-template (1.2.1)
    Loading from cache

  - Installing phpunit/phpunit-mock-objects (2.0.10)
    Downloading: 100%         

  - Installing phpunit/php-timer (1.0.7)
    Loading from cache

  - Installing phpunit/php-file-iterator (1.3.4)
    Downloading: 100%         

  - Installing phpunit/php-code-coverage (2.0.17)
    Downloading: 100%         

  - Installing phpunit/phpunit (4.0.20)
    Downloading: 100%         

  - Installing squizlabs/php_codesniffer (1.5.6)
    Loading from cache

  - Installing vectorface/dunit (v2.1.0)
    Loading from cache

react/event-loop suggests installing ext-event (~1.0)
react/event-loop suggests installing ext-libev (*)
react/event-loop suggests installing ext-libevent (>=0.1.0)
phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
Generating autoload files
MacBook-Air-de-thebestclass:htdocs thebestclass$ /Applications/XAMPP/xamppfiles/bin/php /Applications/XAMPP/xamppfiles/htdocs/examples/secure-messages/ping.php
MacBook-Air-de-thebestclass:htdocs thebestclass$ /Applications/XAMPP/xamppfiles/bin/php /Applications/XAMPP/xamppfiles/htdocs/examples/time-format/time.php
MacBook-Air-de-thebestclass:htdocs thebestclass$ /Applications/XAMPP/xamppfiles/bin/php /Applications/XAMPP/xamppfiles/htdocs/examples/messages/ping.php

The first and second script runs until 13 seconds as expected, but show nothing (echo) and the last wheel endlessly as expected but does not show anything.

oviniciuslara commented 8 years ago

@WyriHaximus I did test and I could see that the message reached the file of the child process, but not back to the parent process file.

WyriHaximus commented 8 years ago

@thebestclass I'll add error reporting to the examples and a better way of looking into the data stream for debug purposes.

oviniciuslara commented 8 years ago

@WyriHaximus Is there anything I can do? I added error_reporting(E_ALL) in format.php and time.php but still nothing happened differently ..

WyriHaximus commented 8 years ago

The messenger emits an error event when something goes wrong.

oviniciuslara commented 8 years ago

@WyriHaximus So what can it be? I can not find anything to make it work

WyriHaximus commented 8 years ago

Hey sorry for the delay, something came up yesterday. I've just added error reporting to the examples and will add a STDIN, STDOUT, STDERR emits in a minute.

oviniciuslara commented 8 years ago

@WyriHaximus #update

When I put the error catching code in 'examples/messages/ping.php' several errors were generated thousands. It is so great that I can not post. https://jsfiddle.net/dwo757w2/

WyriHaximus commented 8 years ago

Can you catch them some how? (If all else fails a screenshot will do 👍.) | less could be used on OSX/Linux.

oviniciuslara commented 8 years ago

@WyriHaximus I do not believe in that. it's all because of this error

DateTime::__construct(): It is not safe to rely on the system\'s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone \'UTC\' for now, but please set date.timezone to select your timezone.\

WyriHaximus commented 8 years ago

I suggest you follow the instructions in the error and set date.timezone in your php.ini to the fitting timezone. ☺

oviniciuslara commented 8 years ago

@WyriHaximus Sorry for the delay, I was ashamed and also wanted to see if there were more errors. Thank you very much for your time, sorry about anything. Hugs

WyriHaximus commented 8 years ago

No problem and good luck with your project :+1: .