On Wed, 21 Jul 2004 10:09:52 -0700, bruce <[EMAIL PROTECTED]> wrote:
> hey...
> 
> looking at initiating a perl app from inside a php web app. basically, the
> user will hit a button/start the app...the perl script will take awhile to
> complete, so i'd like to run the app and then continue on with the php
> process...
> 
> so my question boils down to what's the best approach.
> 
> 1) i could run the perl app, and wait until it finishes, and then continue
> with the logic. the app will use the results of the perl script and stuff it
> into a db/tbl, so i need to get the results of the perl app.
> 
> 2) i could run the perl script, and have it somehow run in the
> background.... this would ba good, if there's a way to essentially run the
> php script in the background such that it doesn't hang apache. i'd like to
> kick off the php, and have the php/web app return. i could set some form of
> session var to trigger off of when the php is complete..
> 
> any thoughts/pointers/etc...
> 

AFAIK there's no way to do this. When the request ends (user hits
stop, exit or die called) the process is ended. This includes
children. If you could set it off asynchronously, there would be no
way of knowing when it ended as the process wouldn't have access to
that session any more.

I would suggest setting a value in a table and have a cron job check
for those values, run the script if it's supposed to, then update the
table with the results. Then the PHP script can check the table to see
it it's done.

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to