Topic: Running parallel\Runtime with php-8.0.23-1.el8.remi

Hi, I need to implement some multi-thread processing with php. Have been trying to run a sample script, basic-multithreading-test.php, that uses parallel\Runtime. We have a number of PHP 8.0.23 packages installed, and it is ZTS. It seems to fail in the use parallel\Runtime statement. I am fairly new to PHP. Could someone please share some tips on getting started with using parallel\Runtime.

Running el8

$ /usr/bin/zts-php --version
PHP 8.0.23 (cli) (built: Aug 30 2022 12:16:34) ( ZTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.23, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.23, Copyright (c), by Zend Technologies

use parallel\Runtime

./basic-multithreading-test.php
Error:Class "parallel\Runtime" not found

php-cli-8.0.23-1.el8.remi.x86_64
php-8.0.23-1.el8.remi.x86_64

Re: Running parallel\Runtime with php-8.0.23-1.el8.remi

If you want to use the parallel extension, you need to install it

BTW this extension is only for PHP 7.x

Notice: but you can try the Fiber feature, see https://www.php.net/fiber

Desktop: Fedora 35 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 36 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Running parallel\Runtime with php-8.0.23-1.el8.remi

New version 1.2.0 of parallel extension is released and is available in the repository for PHP 8.0, 8.1 and 8.2

Desktop: Fedora 35 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 36 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Running parallel\Runtime with php-8.0.23-1.el8.remi

I have tried to run the example code shown in the PHP manual for fiber. I get a class not found. I presume We need to load an extension package for fiber. We do have a number of remi repos configured in our /etc/yum.repos.d. I have searched through these but have not located the package. Could someone please advise me on how to find the depot and package name. I am new at this, please excuse my inexperience.

[rh3124@rltv11495 ~]$ /usr/bin/zts-php -f basicUsageFiber.php
PHP Fatal error:  Uncaught Error: Class "Fiber" not found in /home/rh3124/basicUsageFiber.php:2
Stack trace:
#0 {main}
  thrown in /home/rh3124/basicUsageFiber.php on line 2


[rh3124@rltv11495 ~]$ /usr/bin/zts-php --version
PHP 8.0.23 (cli) (built: Aug 30 2022 12:16:34) ( ZTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.23, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.23, Copyright (c), by Zend Technologies


Thank you,
Russ

Re: Running parallel\Runtime with php-8.0.23-1.el8.remi

Fiber is a 8.1 new feature

Desktop: Fedora 35 + rpmfusion + remi-test + remi-dev
Laptop:  Fedora 36 + rpmfusion + remi (SCL only)
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi