Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

split off a server request?

Status
Not open for further replies.

dougthonus

Programmer
Feb 28, 2005
1
US
I am writing some software, and the php script that does all the database management for one section of it seems to take an absurdly long time (way longer than I think it should, but I'm not quite sure why right now, possibly a bad query somewhere that takes too long).

Anyway, I was curious, is there a way that I can can have php basically submit the long portion of this code to run in a background process instead of having the user have to wait for it to run?

Basically, I'm running something that does a post, so I want the server to act as if a user hit the url that was posted to while letting the user go do whatever.

My first thought (and what I may still try) is to do a fork, and exec lynx to go to the posted url, but I'm unsure how to include the posted data in lynx (though I could change it to a get in theory to solve the problem).
 
Since you have mentioned fork and lynx, I will assume you are running PHP on a unix-like OS. One possibility is to have your user-contacted script add necessary data to a queue, and have a cron-run PHP script pull data from the queue and process it.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top