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

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

WARNING [EMAIL PROTECTED] address is an endangered species -- Use
Wanna help me out?  Like Music?  Buy a CD:
Volunteer a little time:
----- Original Message -----
From: Jordan Pickup <[EMAIL PROTECTED]>
Newsgroups: php.general
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
> 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
> find an answer anywhere else... and the archive for this list seems to be
> down.
> Jordan

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to