PHP and run 2 scripts

I would like to have a background script running that will run continuously but am having problems in trying to get it working, if it is possible.  Basically a user submits a form and it'll load two scripts, one background script and one foreground script.  I tried using frames to do it, with the background script in one frame and a foreground script in another frame.  But if the background script runs continuously in the first frame the second frame which contains the foreground script can never get processed.  Also the foreground script will refresh probably about every 30s or so and I am using meta tags to do it.  So how can I have a background script continuously running and also have the foreground script be processed as well?
Who is Participating?
TomeeboyConnect With a Mentor Commented:
I don't think you can really accomplish this with just PHP.  If you're wanting to retrieve client-side information continuously without the user actuall submitting something, I think you would need to use some type of Javascript (possibly an AJAX script), or even ActiveX.  Regardless of how you do it.. you can't just have a stand-alone PHP script that actually RUNS continuously and keeps retrieving client-side data.  PHP doesn't work the same way a Windows executable or service would work, for example.
Hi kdavidm,

Not entirely sure what it is that you are trying to do.   What are these scripts actually going to be doing?  Particularly, what is the script that you want to be running continuously?  Since PHP is server side.. I'm not sure what the background script could actually be doing that would require it to be running indenfinitely.
kdavidmAuthor Commented:
The background script just gets updates from user interaction and communication then stores the data in a database, the foreground script reads in these updates from the database and outputs them every 30s for example.  Yes I know it isin't very efficient and yes there are better and more simpler ways to do it without using PHP, but I want to use PHP to do it.  So I would like to know if it's possible to have two scripts running, one background continuously and one foreground.
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

PHP script ends the moment it is relivered to the client and no way to leave it running. Maybe you can use php-java integration, haven't tried it my self, but have a look at that link
Try to take a look PHP command line
PHP-CLI (Command Line Interface), may it can work for your case.
All Courses

From novice to tech pro — start learning today.