asynchronous PHP to PHP call

I have a PHP script running on server 1. I want it to call another
script on server 2 to clean up some files. There may be tons of
files and I don't want to wait until the second script is finished.

Is there a way to asynchronously call the second PHP script?

Right now I'm using fopen() to call the script on the second server.
--
-James

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
James [ Di, 13 September 2005 23:11 ] [ ID #964864 ]

Re: asynchronous PHP to PHP call

James wrote:
> I have a PHP script running on server 1. I want it to call another
> script on server 2 to clean up some files. There may be tons of files
> and I don't want to wait until the second script is finished.
>
> Is there a way to asynchronously call the second PHP script?
>
> Right now I'm using fopen() to call the script on the second server.

Set ignore_user_abort in the second script and close the socket
immediately. Untested, but conceptually it should work.

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jasper Bryant-Greene [ Di, 13 September 2005 23:16 ] [ ID #964866 ]

Re: asynchronous PHP to PHP call

James schrieb:
> I have a PHP script running on server 1. I want it to call another
> script on server 2 to clean up some files. There may be tons of
> files and I don't want to wait until the second script is finished.
>
> Is there a way to asynchronously call the second PHP script?
>
> Right now I'm using fopen() to call the script on the second server.

Other option: Don't let the called script on server 2 do the work. Use
it to start another phpcli-script, then immediately send out the answer.
Something like

<?php
exec('/usr/bin/php cleanup.php &');
echo 'Cleanup started.';
?>

OLLi

____________
To the optimist, the glass is half full.
To the pessimist, the glass is half empty.
To the engineer, the glass is twice as big as it needs to be.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
oliver.graetz [ Di, 18 Oktober 2005 18:25 ] [ ID #1018975 ]
PHP » gmane.comp.php.general » asynchronous PHP to PHP call

Vorheriges Thema: Using .htaccess files with PHP CGI
Nächstes Thema: Uploaded CSV -> database