PHP program execution/termination

Posted on 2003-03-27
Medium Priority
Last Modified: 2006-11-17
Here's what I'd like to do... someone please tell me if its possible and how I might accomplish it:

I've got an external executable written in C and compiled. What it does is not important but it has the potential to run for a VERY long time.

I would like to make PHP execute this program but for a maximum of about 30 seconds so as not to delay the loading of the page significantly. If possible, to actually display an animated
gif before the program is executed (not sure how I would accomplish this).

Basically, I'd like php to execute the program, gathering its output in an array, but then kill the process if its taking too long so the page can finish loading and the visitors arent made to wait too long.

Question by:jmfreema
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
  • 3
  • 2
LVL 15

Expert Comment

ID: 8221362
make it differently.
Use a hidden frame that "launches and surveys" the external program
During this time, the visitors have a fully functional site for themselves 8-)

I even use an IFRAME for this, on a site that hsa exactky the same problem (user access during a loooong update via the Net)
LVL 15

Accepted Solution

VGR earned 165 total points
ID: 8221385
in the IFRAME, the people can follow the progression of the update running completely independently from their surfing of the site.

I synchronize both processes via the DB

Author Comment

ID: 8584689
Thanks anyway VGR: that answers a question, just not the one I asked ;)

I'm closing this just in the interest of cleanliness, but I still have to figure out how to do this. I think I might have to re-write the C code to terminate if too much time has passed.


Author Comment

ID: 8584829
:( Is there any way to change a grade once its given? I meant for that to be a 'B'
LVL 15

Expert Comment

ID: 8585105

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
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.
Suggested Courses

800 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