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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:25:44+00:00 2026-05-14T08:25:44+00:00

i need to run a really long php script (four and half, five hours).

  • 0

i need to run a really long php script (four and half, five hours).

the script sometimes runs successfully, but sometimes gets killed inexplicably (poss something to do with the shared hosting??).

i think that the solution maybe to run the script is smaller chunks.

in order to do this i have written a script that stores it’s status & position in an xml file, and executes one chunk of the script, before moving the position on.

i am having problems hooking up the last bit of the script, which should end the current process & re-execute the script.

or maybe i am barking up the wrong tree completely!

i have read through what i can find on SO and elsewhere but i’m still none the wiser 🙁

please help!!!

dan

  • 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-14T08:25:44+00:00Added an answer on May 14, 2026 at 8:25 am

    Considering you have a script that run’s forever but won’t cause inconsistend data, you could use a cronjob.

    The problem is that you need to know if your script is still running, because you likely don’t wanna start it twice. Two solutions i have on mind are the process id of the script (getmypid()) or using a timestamp.

    For PID:

    • Save PID on script startup (to /tmp/script_pid)
    • Trigger cronjob each minute. Lookup active process with save PID, and start if not found.

    You need access to php’s exec() (and friends) and command line tools like linux’ “ps”.

    For timestamp:

    • Save timestamp each iteration.
    • Trigger cronjob each minute. If timestamp is older than X, start new process.

    You have to figure out how long X should be yourself.

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

Sidebar

Ask A Question

Stats

  • Questions 530k
  • Answers 530k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your configuration file looks correct to me. I know of… May 16, 2026 at 11:35 pm
  • Editorial Team
    Editorial Team added an answer If I really felt my domain model better suited me… May 16, 2026 at 11:35 pm
  • Editorial Team
    Editorial Team added an answer The default empty constructor of the memento class should be… May 16, 2026 at 11:35 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm working on an online PHP application that has a need for delayed PHP
I was trying to run a script to create a DB with all the
I am developing a script to read and search log files for a big
Read some texts about locking in PHP. They all, mainly, direct to http://php.net/manual/en/function.flock.php .
I have a long running console app running through millions of iterations. I want
I'm trying to implement a stateful web service in PHP using the SOAP extension.
my background: i've been developing web applications using php and javascript for the past
The idea is to run a sort of ranking MySQL command such as: $sql
I need a very simple function to draw a bunch of lines with anti-aliasing.
I am having a really hard time getting this marshalling down. I have umanaged

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.