Jump to content

Run a update in the background.


Groogy

Recommended Posts

Yo!

 

I'm designing a game for my Webb project in school and needs some help.

I need to update resources, population, battles and some other stuff.

 

I know I can put it all in one script that's called when a page is requested that loops trough all seconds since the last update.

But the thing is I want it more dynamic so I want like a second process in the background running which updates my database when supposed to.

Any ideas of how to do it?

Link to comment
https://forums.phpfreaks.com/topic/107054-run-a-update-in-the-background/
Share on other sites

Don't really know how Ajax would help?

 

I want it to run independently of my visitors to the site.

 

Like, I know I could program something in C++ that does the MySQL Update for me each hour or something like that.

But then the problem is how I am supposed to launch that program trough PHP?

Sure maybe exec(), but I don't know if the Webb server is running in safe mode since I haven't bought the server yet.

(I am currently working on my Development Server which is located on my own Machine)

Or the server might not even allow executable programs to run.

 

In Ruby I would have solved this by starting a new thread which would run independently from the user.

I don't think PHP got anything like that? Doesn't need to be Kernel-Threads, can be Userspace-Threads too.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.