pfsockopen is useful for having scripts executing others in the background.
I'm writing an intra-site search engine with spidering capabilities. To spider a ~200 page site and index all the text takes about 60 seconds. Because I don't want the user waiting 60s for the script to finish and thinking it's timing out, I use pfsockopen to have the server open an HTTP connection with itself to execute the script in the background. Once the spidering is done, the connection is closed without capturing the HTTP response. The output isn't important, the spidering is!
I just make the script execute the following:
<?php
$st = pfsockopen($_SERVER['HTTP_HOST'], 80, $erstr, $errno, 5);
fwrite($st, "GET {$_SERVER['PHP_SELF']}?$key HTTP/1.0\r\nHost: {$_SERVER['HTTP_HOST']}\r\n\r\n");
?>
Where $key is the QUERY_STRING trigger which starts the spidering process. This script is executed in the background while the main script is free to finish loading and display a message like: "The database is being reindexed, please wait."
BTW, I set a flag in another MySQL table which prevents searches while the spider is crawling.