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 8933669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:35:57+00:00 2026-06-15T09:35:57+00:00

All, I’m looking for a good way to do some job backgrounding through either

  • 0

All,

I’m looking for a good way to do some job backgrounding through either of these two services.

I see PHPFog supports IronWorks, but i need something more realtime. Through these cloud based PaaS services, I’m not able to use popen(background.php --token=1234). So I’m thinking the best solution, might be to try to kick off a gearman worker to handle the job. (Actually my preferred method would be to use websockets to keep a connection open and receive feedback from the job, rather than long polling a db table through AJAX, but none of these guys support websockets)

Question 1 is, is there a better solution than using gearman to offload the job?

Question 2 is, http://help.pagodabox.com/customer/portal/articles/430779 I see pagodabox supports ‘worker listeners’ … has anybody set this up with gearman? Would it work?

Thanks

  • 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-15T09:35:58+00:00Added an answer on June 15, 2026 at 9:35 am

    I am using PagodaBox with a background worker in an application I am building right now. Basically, PagodaBox daemonizes a PHP process for you (meaning it will continually run in the background), so all you really have to do is create a script that checks a database table for tasks to run, runs them, and then sleeps a bit so it’s not running too many queries against your database.

    This is a simplified version of what I have running:

    // Remove time limit
    set_time_limit(0);
    
    // Show ALL errors
    error_reporting(-1);
    
    // Run daemon
    echo "--- Starting Daemon ---\n";
    while(true) {
    
        // Query 'work_queue' table for new tasks
        // Loop over items and do whatever tasks are associated with them
        // Update row to mark task as completed
    
        // Wait a bit
        sleep(30);
    }
    

    A benefit to this approach is that it’s easy to test via CLI:

    php tasks.php
    

    You will see all the echo statements come through in console as it’s running, and of course it’s much easier to do than a more complicated setup with other dependencies like Gearman.

    So whenever you add a new task to the table, the maximum amount of time you’ll wait for that task to be started in a batch is 30 seconds (or whatever your sleep time is). This is better and preferable to cron jobs, because if you setup a cron job to run every minute (the lowest possible interval) and the work you have to do takes longer than a minute, another cron process will start working on the same queue and you could end up with quite a lot of duplicated task work that could cause a lot of issues that are hard to debug and troubleshoot. So if you instead have either only one background worker that runs all tasks, or multiple background workers that work on different task types, you will never run into this issue.

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

Sidebar

Related Questions

All -- I have these two methods in one of my classes: public static
all. We're trying to get some intersect collisions working, but the problem experience is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
All, I'm using wordpress with this and for some reason the eventDrop stopped working.
All, We could really do with some advice from SVG gurus. WHAT WE HAVE:
All, is there any means by which it is possible to connect to two
all is in the title :-) Some explanation : In order to use a
all. I've got two domains set up under apache on a single server (Linux).
All, In my Lex file we recognize some operators as Tokens some of this
All, See the code below: function menu() { this.menuitem=[]; this.submenu=[]; this.menuitem[0] = $('div#sivname1'); this.menuitem[1]

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.