l33t Posted August 8, 2007 Share Posted August 8, 2007 Hi, iam abit of a nub at web site related stuff, iam however a advanced c programmer and i want to no before i decide to learn if php is capable of something iam gonna do. The thing is i want to upload a application on a web sever and i want it to run for a certain amount of time even while iam not on the site, it is acolor reconizing program which i want to be able to browse a certain game... iam sure you no what iam getting at now. But is php capable of this? is the web server capable of running while no one is on the site just like a application on platform? ??? i really need some help from a pro please. Quote Link to comment Share on other sites More sharing options...
jscix Posted August 8, 2007 Share Posted August 8, 2007 I'm hoping english isn't your first language, but from the sounds of: "it is color reconizing program which i want to be able to browse a certain game", sounds like you might need something like java... Quote Link to comment Share on other sites More sharing options...
l33t Posted August 8, 2007 Author Share Posted August 8, 2007 Ok iam sorry about my bad typing =p, was just doing it fast, and the program is not the problem its rather i can have the server run the program while iam not on the site running it manually thats all. Quote Link to comment Share on other sites More sharing options...
tarun Posted August 8, 2007 Share Posted August 8, 2007 Isn't There Crons (Cron Jobs) For That But I No Nothing About Them ??? And Im No Expert In This Area But Could You Use Exec Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted August 8, 2007 Share Posted August 8, 2007 php can run executables via the exec() function however I don't know how you would "stop it" but you can built that in the executable its self and just set up a cron job to start it. Quote Link to comment Share on other sites More sharing options...
Orio Posted August 8, 2007 Share Posted August 8, 2007 You can kill the program by using the kill command in exec() too (I think =/). Also you should have a look into ignore_user_abort() so you won't have to keep your browser open. Orio. Quote Link to comment Share on other sites More sharing options...
l33t Posted August 8, 2007 Author Share Posted August 8, 2007 Thanks everyone your help was great , well ill start learning php. Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted August 8, 2007 Share Posted August 8, 2007 remember that if a script or program exceeds your hosts limits, that can cuase trouble. so its fine to simply run the script while are away from that domain, however youll need to limit how long it runs for, and how much CPU its taking up, most hosts have very strict limits on this Quote Link to comment Share on other sites More sharing options...
tarun Posted August 8, 2007 Share Posted August 8, 2007 I Don't No If This Helps But I Found This Bit Of Code If you want to simulate a crontask you must call this script once and it will keep running forever (during server uptime) in the background while "doing something" every specified seconds (= $interval): <?php ignore_user_abort(); // run script in background set_time_limit(0); // run script forever $interval=60*15; // do every 15 minutes... do{ // add the script that has to be ran every 15 minutes here // ... sleep($interval); // wait 15 minutes }while(true); ?> Quote Link to comment Share on other sites More sharing options...
l33t Posted August 8, 2007 Author Share Posted August 8, 2007 Awesome, although i gotta get used to asigning the varibles with $ because the last few languages i did i assigned them differently :-\ and the functions look pretty advanced to. btw do the functions in php return values? Quote Link to comment Share on other sites More sharing options...
Orio Posted August 9, 2007 Share Posted August 9, 2007 Yeah they can if you want, return anything- arrays, integers, strings or nothing. Orio. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.