Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7909755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:35:05+00:00 2026-06-03T12:35:05+00:00

Client: <?php $gmclient= new GearmanClient(); $gmclient->addServer(); $gmclient->doBackground(reverse, this is a test); echo done!\n; Worker:

  • 0

Client:

<?php

$gmclient= new GearmanClient();
$gmclient->addServer();
$gmclient->doBackground("reverse", "this is a test");

echo "done!\n";

Worker:

<?php

echo "Starting\n";

$gmworker= new GearmanWorker();
$gmworker->addServer();
$gmworker->addFunction("reverse", "reverse_fn");

while($gmworker->work()){}

function reverse_fn($job)
{

  $result= strrev($job->workload());

  $fp = fopen('test.txt', 'a');
  fwrite($fp, $result);
  fclose($fp);
  echo "Result: $result\n";
  return $result;
}

?>

The problem is that when I call the client nothing happens until I run

php worker.php

then it writes to the file, but the shell is just stuck at

[user@server gearman]$ php worker.php 
Starting
Result: tset a si siht

Is there anyway I can make it so that when it calls doBackground, it runs the worker.php file in the background? I also want to make sure this work when gearmand is restarted so that I don’t have to run worker.php if the daemon is restarted.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T12:35:07+00:00Added an answer on June 3, 2026 at 12:35 pm

    Posted as answer from my comment:

    Take a look at supervisord (supervisord.org) for managing your php scripts. supervisor will do the process management for you, and respawn php scripts in the background if they die

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making an MSN client in PHP. I have this code, which connects to
The server Contents are server.php: <?php $err[foo]=bar; ?> The client.php <?php require 'server.php'; echo
I'm debugging some client PHP code that has me stumped. As this pseudo-example illustrates,
I am using the elastica php client for ElasticSearch. I'm a bit new to
Is there any open source web client php application without popup server configuration ,
My client has PHP running on an IIS server, I know these vti_conf files
im using the Facebook PHP Client library and want to get the Events of
Background: Using jQuery 1.7 client side PHP server side Using json responses with json_encode
I'm looking to implement a REST client in PHP, and have previously been using
I am trying to send data from PHP Client to Python Server. CLIENT <?php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.