0

I'm trying to install a multi-thread PHP system on one of my server. After a few readings, the simplest solution seems to use Pthreads with an amphp\thread implementation.

http://www.mullie.eu/parallel-processing-multi-tasking-php/

So, If I'm right the steps were this :

When I'm trying to install php-uv, I get an error on the step:

make -C libuv CFLAGS=-fPIC

Because the libuv directory is not on the git so I think I'm missing something...

Never the less, I also installed php libevent which can do the trick if I don't misunderstand the amphp README.

  • How can I test that this kind of library are well installed? I don't get any error, but who knows?**
  • Also, I install amphp with composer as it's described in the docs. But again, how can I test that the installation went well?

Then, if I assume everything went well, I can now install amphp/thead. Same question with the composer, how can I be sure that it's OK?

Then, I'm supposed to be ready so I create a test.php file with the example code in the amphp/thread and of course... I get an error which said that Amp\Thread\Dispatcher class is not found. Of course I'm running it in CLI.

So to sum up, I only get error when installing php-uv which doesn't seem to be absolutely required to run the class. So I'm pretty sure I'm missing something somewhere but don't know what...

womble
  • 96,255
  • 29
  • 175
  • 230

1 Answers1

1

You do not need uv nor libevent, they don't play together with pthreads.

There's now a stable release for amphp/amp, but amphp/thread is still not stable, it's not even updated to the stable release of amp yet.

If you don't get an error during installation, everything went well. That's typical for Linux, if there's no message, everything usually worked well.

To get some test.php up and running with composer, you have to include the autoloader:

<?php

require __DIR__ . "/vendor/autoload.php";

// your code here...

You can play with amphp/thread, but be warned, the API may change at any time without any notice.

kelunik
  • 203
  • 2
  • 13