Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to install new php parallel (7.2+) on windows and maybe wampserver

new php parallel. it's new and there is no troubleshooting about it anywhere and the only documentation about it, is php.net itself which is not enough.

this is what I did (per instructions):

  • installed latest version of WAMP(3.1.9 x64).
  • installed latest version of PHP(7.3.9) on WAMP.
  • added PHP to windows system environment path.
  • added pthreadVC2.dll to PHP folder & added pthreadVC2.dll to windows system environment path.
  • added php_parallel.dll to php/ext directory.
  • added extension=parallel to php.ini.
  • restarted everything.
<?php
# this is my code
$runtime = new \parallel\Runtime();

$future = $runtime->run(function(){
    for ($i = 0; $i < 50; $i++)
        echo "$i";
        
    return "easy";
});

for ($i = 0; $i < 50; $i++) {
    echo ".";
}

hours spent. now windows cmd says:
"Fatal error: Uncaught Error: Class 'parallel\Runtime' not found in ...[my file address]"
and wampserver says "The connection was reset (firefox error)" only on the page I use parallel\Runtime and the other pages work fine.
and please with all do respect don't mark my question as broad one or any other things if you simply don't know the answer. at least show me some links.

like image 371
Miky1992 Avatar asked Sep 19 '25 15:09

Miky1992


1 Answers

As far as I can tell, to install an extension from a .dll provided by PECL, the following need to match between your extension and your PHP build, found in phpinfo():

  1. PHP Version: Found in PHP Version
  2. Thread Safe: Found in PHP Extension Build (TS=threadsafe or NTS=not-threadsafe)
  3. Compiler Version: Found in PHP Extension Build (eg: VS15 or VS16)
  4. x86 vs x64: Found in Architecture

On the PECL repository for parallel, you should check latest updated version and the package names are self-explanatory, so you can choose your desired one, i.e. ... 7.3-ts-vc15-x64


Note (maybe does not apply now): Given the limited builds of parallel, your PHP Build must be: 7.3+, TS, and VC15. Double-check that this is indeed the case for you by looking at your phpinfo(), and also be sure you are using the x64 version (since you said your PHP is x64).

like image 177
JS_Riddler Avatar answered Sep 21 '25 07:09

JS_Riddler