PHP 8.4.2 Released!

La clase GearmanWorker

(PECL gearman >= 0.5.0)

Introducción

Sinopsis de la Clase

class GearmanWorker {
/* Métodos */
public addFunction(
    string $function_name,
    callable $function,
    mixed &$context = ?,
    int $timeout = ?
): bool
public addOptions(int $option): bool
public addServer(string $host = 127.0.0.1, int $port = 4730): bool
public addServers(string $servers = 127.0.0.1:4730): bool
public clone(): void
public __construct()
public echo(string $workload): bool
public error(): string
public getErrno(): int
public options(): int
public register(string $function_name, int $timeout = ?): bool
public removeOptions(int $option): bool
public returnCode(): int
public setId(string $id): bool
public setOptions(int $option): bool
public setTimeout(int $timeout): bool
public timeout(): int
public unregister(string $function_name): bool
public wait(): bool
public work(): bool
}

Tabla de contenidos

add a note

User Contributed Notes 2 notes

up
1
szhvoj@gmail!com
2 years ago
Use systemd for managing this process:

---- 8< ---- /lib/systemd/system/gearman-worker.service
[Unit]
Description=My own gearman worker

[Service]
ExecStart=/usr/bin/php /var/www/my-worker.php
Restart=always

[Install]
WantedBy=multi-user.target
---- >8 ---- /lib/systemd/system/gearman-worker.service
systemctl daemon-reload
systemctl enable gearman-worker
systemctl start gearman-worker
up
-5
spacewalker2002 at ukr dot net
11 years ago
For background run use:

exec("nohup php worker.php >/dev/null 2>/dev/null &");
To Top