Skip to content

php-gearman extension #1128

Closed
Closed

Description

@nook24

Hi,
it would be nice to add the gearman extension: https://pecl.php.net/package/gearman

For Linux, I was able to successfully test it with FrankenPHP

FROM dunglas/frankenphp:latest-php8.3

RUN apt-get update && apt-get install -y \
    libgearman-dev \
    && rm -rf /var/lib/apt/lists/*

RUN pecl install gearman \
    && docker-php-ext-enable gearman

Run the Container

docker run --rm -it --add-host=host.docker.internal:host-gateway -v /root/StatusengineOcspProcessor.php:/root/StatusengineOcspProcessor.php my-frankenphp-gearman bash

This is my PHP Gearman Test Code:

<?php

print_r(get_loaded_extensions());

$StatusengineOcsp = new StatusengineOcspProcessor();
$StatusengineOcsp->loop();

//Example Class
class StatusengineOcspProcessor{

    /**
     * @var \GearmanWorker
     */
    private $GearmanWorker;

    public function __construct(){

        $GearmanClient = new \GearmanClient();
        $GearmanClient->addServer('host.docker.internal', 4730);
        $GearmanClient->doBackground('statusngin_ocsp', json_encode(['test' => 'data']));


        //Create the GearmanWorker PHP Object
        $this->GearmanWorker = new \GearmanWorker();

        //Connect to the Gearman-Job-Server
        $this->GearmanWorker->addServer('host.docker.internal', 4730);

        //Consume data from the queue statusngin_ocsp and pass it
        //to the php method handleOcsp of the this class
        $this->GearmanWorker->addFunction('statusngin_ocsp', [$this, 'handleOcsp']);
    }

    public function loop(){
        //Start infinite loop to consume incoming jobs
        while(true){
            $this->GearmanWorker->work();
        }
    }

    public function handleOcsp($job){
        //Print service check data to stdout
        print_r(json_decode($job->workload()));
    }

}

You should get the output

stdClass Object
(
    [test] => data
)

Activity

  1. henderkes commented on May 6, 2026

    @henderkes
    Collaborator

    Oh boy. gearman relies on boost. Enjoy the 2 hour build times.

  2. henderkes commented on May 6, 2026

    @henderkes
    Collaborator

    Thankfully it's only the programs requiring it, we can build just the library

    ❯❯ static-php-cli git:(v3-dev) 11:17 buildroot/bin/php --ri gearman
    
    gearman
    
    gearman support => enabled
    extension version => 2.2.1
    libgearman version => 1.1.22
    Default TCP Host => localhost
    Default TCP Port => 4730
  3. henderkes commented on May 6, 2026

    @henderkes
    Collaborator

    will be closed by #980 when v3 alpha releases

  4. added this to the 3.0 Release milestone on May 6, 2026
  5. nook24 commented on May 6, 2026

    @nook24
    Author

    Many thanks for your fast solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/extensionIssues related to extensionsnew featureNew feature or request

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions