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

  • SEARCH
  • Home
  • 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 7163319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:53:00+00:00 2026-05-28T13:53:00+00:00

I’m putting together my first commercial PHP application, it’s nothing really huge as I’m

  • 0

I’m putting together my first commercial PHP application, it’s nothing really huge as I’m still eagerly learning PHP 🙂

Right now I’m still in the conceptual stage of planning my application but I run into one problem all the time, the application is supposed to be self-hosted by my customers, on their own servers and will include some very long running scripts, depending on how much data every customer enters in his application.

Now I think I have two options, either use cronjobs, like for example let one or multiple cronjobs run at a time that every customer can set himself, OR make the whole processing of data as daemons that run in the background…

My question is, since it’s a self-hosted application (and every server is different)… is it even recommended to try to write php that starts background processes on a customers server, or is this more something that you can do reliably only on your own server…?

Or should I use cronjobs for these long running processes?

(depending on the amount of data my customers will enter in the application, a process could run 3+ hours)

Is that even a problem that can be solved, reliably, with PHP…? Excuse me if this should be a weird question, I’m really not experienced with PHP daemons and/or long running cronjobs created by php.

So to recap everything:
Commercial self-hosted application, including long running processes, cronjobs or daemons? And is either or maybe both also a reliable solution for a paid application that you can give to your customers with a clear conscience because you know it will work reliable on all kinds of different servers…?

EDIT*
PS: Sorry, I forgot to mention that the application targets only Linux servers, so everything like Debian, Ubuntu etc etc.

  • 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-05-28T13:53:01+00:00Added an answer on May 28, 2026 at 1:53 pm

    Short answer, no, don’t go for background process if this will be a client hosted solution. If you go towards the ASP concept (Application Service Provider… not Active Server Pages ;)) then you can do some wacky stuff with background processes and external apps connecting to your sql servers and processing stuff for you.

    What i suggest is to create a strong task management backbone and link that to a solid task processing infrastructure. I’ll recommend you read an old post i did quite some time ago regarding background processes and a strategy i had adopted to fix long running processes:

    Start & Stop PHP Script from Backend Administrative Webpage

    Happy reading…

    UPDATE

    I realize that my old post is far from easy to understand so here goes:

    You need 2 models: Job and JobQueue, 2 controller: JobProcessor, XYZProcessor

    JobProcessor is called either by a user when a page triggers or using a cronjob as you wish. JobProcessor::process() is the key that starts the whole processing or continues it. It loads the JobQueues and asks the job queues if there is work to do. If there is work to do, it asks the jobqueue to start/continue it’s job.

    JobQueue Model: Used to queue several JOBS one behind each other and controls what job is currently current by keep some kind of ID and STATE about which job is running.

    Job Model: Represents exactly what needs to be done, it contains for example the name of the controller that will process the data, the function to call to process the data and a serialized configuration property that describe what must be done.

    XYZController: Is the one that contains the processing method. When the processing method is called, the controller must load everything it needs to memory and then process each individual unit of work as fast as possible.

    Example:

    1. Call of index.php
    2. Index.php creates a jobprocessor controller
    3. Index.php calls the jobprocessor’s process()
    4. JobProcessor::Process() loads all the queues and processes them
    5. For each JobQueue::Process(), the job queue loads it’s possible Jobs and detects if one is currently running or not. If none is running, it starts the next one by calling Job::Process();
    6. Job::Process() creates the XYZController that will work the task at hand. For example, my old system had an InvoicingController and a MassmailingController that worked hand in hand.
    7. Job::Process() calls XYZController::Prepare() so that it loads it’s information to process. (For example, load a batch of emails to process, load a batch of invoices to create)
    8. Job::Process() calls XYZController::RunWorkUnit() so that it processes a single unit of work (For example, create one invoice, send one email)
    9. Job::Process() asks JobProcessingController::DoIStillHaveTimeToProcess() and if so, continues processing the next element.
    10. Job::Process() runs out of time and calls XYZController::Cleanup() so that all resources are released
    11. JobQueue::Process() ends and returns to JobController
    12. JobController::Process() is about to end? Open a socket, call myself back so i can start another round of processing until i don’t have anything to do anymore
    13. Handle the request from the user that start in position #1.

    Ultimately, you can instead open a socket each time and ask the processor to do something, or you can queue a CronJob to call your processor. This way your users won’t get stuck waiting for the 3/4 work units to complete each time.

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

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
I have a jquery bug and I've been looking for hours now, I can't
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to create an if statement in PHP that prevents a single post

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.