Solved

PHP As Batch Process...

Posted on 2013-05-24
4
262 Views
Last Modified: 2013-06-07
Hi,

A bit of a speculative question here;

In a week or so, I need to start building PHP processes that need to run on my server and do daily, weekly and monthly tasks.

They will be started, and log start, end times and progress into a MySQL table.

Anyone got any pointers?  Never done this before with PHP.

Thanks,

Cris.
0
Comment
Question by:CrisThompsonUK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39195004
Think about how you want to trigger these processes.  Maybe a CRON job or scheduled task?

Think carefully about whether the processes can be rerun or restarted without damaging anything in the data base.

Those would be my top considerations, not knowing anything more about what exactly you want to accomplish.
0
 

Author Closing Comment

by:CrisThompsonUK
ID: 39228599
Thanks Ray.

that's about what I was thinking.

After 10 years of making website backends, I'm currently developing a whole backend system for a company with lots of procedure calls and batch processes..  

It's like my old days software engineering, and it's coming back!

I do have a further question:
I have a php script called from a screen to update some stuff, but one of the tasks it needs to do will take about 15 seconds to complete.  I don't want to make the user wait for this, so how can I make my php do it's thang, but also fire off another php script to do the other longer thing.

About to turn to google...
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39228718
Thanks for the points.  This article may be helpful in planning asynchronous or long-running scripts.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/A_11271-Understanding-Client-Server-Protocols-and-Web-Applications.html

You can make POST-method requests to start PHP scripts.  The "screen" script will be initiated by a client GET-method request, just like any web page.  This script, in turn, will make POST requests to start the long-running scripts.  The long-running scripts may want to use ignore_user_abort() to allow them to run asynchronously.  See also.  Since these scripts are started via POST and do not have browser output, you'll probably want some way to access diagnostic messages.  The easiest way to start a script with a POST request is probably to use fsockopen() or the cURL library.
0
 

Author Comment

by:CrisThompsonUK
ID: 39229139
thanks, I'll open a new question for this...
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question