FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Running function in the background?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Running function in the background? [message #176595 is a reply to message #176594] Tue, 10 January 2012 16:39 Go to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
Am 10.01.2012 17:29, schrieb M. Strobel:
> Am 10.01.2012 02:32, schrieb John Drako:
>> I have a site where users can download files, and I want to enable the
>> users to request files by email. Some of those files are big (not too
>> big for email attachements).
>>
>> What I would like to have the user be able to do is to click on a file
>> and have it emailed to him, but the user shouldn't have to wait for the
>> emailing function to finish (tens of seconds some time) and continue
>> browsing and clicking on other files to email or even leave the site
>> confident that they'll receive the files in their email later.
>>
>> So I would like the emailing functionality to happen in the background
>> and independent from the connection to the browser.
>>
>> Is this possible? Is it doable in PHP directly?
>>
> Damn good question.
>
> As to do it in PHP directly I find
> http://stackoverflow.com/questions/317392/is-process-forking-in-php-apache- a-good-idea
> with links to other questions of this type.
>
> I never did forking in the web server because I consider it
> dangerous, it can kill or hang it or send it into a loop.
>
> I did it like Mike suggested, with cron-jobs running every 10
> minutes, and even with my own daemon "watching" a job file. For
> shared hosting mostly not doable..
>
> /Str.

Addition:

If the at command works okay in your server you can schedule jobs
in your script. I do it in a cgi script calling a shell script,
and this does

echo /usr/local/bin/webblock remove $2 | /usr/bin/at now + 5
minutes 2>/dev/null
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: form - file - sumple question
Next Topic: Lilupophilupop
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 02:40:42 GMT 2024

Total time taken to generate the page: 0.04403 seconds