Groogy Posted May 24, 2008 Share Posted May 24, 2008 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 More sharing options...
Darklink Posted May 24, 2008 Share Posted May 24, 2008 I would suggest using Ajax or Cron jobs, although cron jobs are not php based. They are done through command line and call a php script every time you specify (hourly, daily, etc). Try Ajax? Link to comment https://forums.phpfreaks.com/topic/107054-run-a-update-in-the-background/#findComment-548813 Share on other sites More sharing options...
Groogy Posted May 24, 2008 Author Share Posted May 24, 2008 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. Link to comment https://forums.phpfreaks.com/topic/107054-run-a-update-in-the-background/#findComment-548835 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.