Re: A Separate Process?

From: Date: Thu, 30 Aug 2001 09:55:48 +0000
Subject: Re: A Separate Process?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-65231@lists.php.net to get a copy of this message
You could just log the IP into a database, and then look it up later in another script in a "cron" job. You'll need PHP installed as a stand-alone binary (aka CGI) and you'll want to read: man 5 crontab You could use select distinct and then would only need to look up each IP once for a user that viewed many pages. If you wait too long, though, the IPs will change on you for DHCP clients. Still the same country probably though. To answer your original question :-) what you are talking about is called "fork" (like a fork in the road) and you do it something not unlike this: exec("/path/to/some/other/script &", $results, $errorcode); echo implode("<BR>\n", $results); if ($errorcode){ echo "OS Error: $errorcode. Usually path/permissions. man errno<BR>\n"; } It's the & symbol that tells the shell to fork. The other script in question has to, errrr, I forget exactly, but I think it has to *NOT* bind up stdin, stdout, or stderr, because then Apache and PHP are waiting for that output... Search the archives for "fork" and "&" and "exec" and you should find more posts. -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Jordan Pickup <JPickup@gprc.ab.ca> Newsgroups: php.general To: <php-general@lists.php.net> Sent: Monday, August 27, 2001 4:03 PM Subject: A Separate Process? > Is there any way to make a separate process in PHP? > > I do real-time stats collection on my site and one of the things I collect > is the domain of the user (to get their country). > > Sometimes getting the domain name takes a few seconds to come back and the > user has to wait for that time before their page displays. > > Is there any way to split of a separate process - that doesn't end when the > current process ends - to do the stats collecting so that the user doesn't > have to wait? > > Or, if not, is there some way to tell the browser that it has all the data > (so that it will finish rendering the page and run my javascript) and the > script can continue running and do the ns lookup? > > I'm sorry if this question has been asked and answered before but I couldn't > find an answer anywhere else... and the archive for this list seems to be > down. > > Jordan

« previous php.general (#65231) next »