mr_zhang Posted November 7, 2007 Share Posted November 7, 2007 Hi guys, I'm currently developing a php program that has a very long run time. I understand that I'm able to extend the run time. However, my hosting provider (it's a shared hosting) has somehow turn the option off so that I'm not able to change the run time of a php script. They said it's a security issue and they won't budge. So I have a question: Is it possible to separate a long file so that they have each own run time but called in one go? I think include() is not the solution of this, although I'm not sure. e.g. I have a cron.php that needs 20 minutes to finished while my hosting only allowed 5 minutes for php run time. This long file could not be executed fully. Then, I would like to separate them into 5 files: cron1.php, cron2.php, cron3.php, cron4.php (each 1/4 of cron.php functions) and cron.php (calls those 4 files) so that they all finished. So, it's like I'm running 4 files with their own run time. Is this situation possible? What is the solution? Regards, Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 7, 2007 Share Posted November 7, 2007 yes, but what do you have that takes 20 minuites? Quote Link to comment Share on other sites More sharing options...
mr_zhang Posted November 7, 2007 Author Share Posted November 7, 2007 It's a cron job. Can't really tell you the program since it will break the agreement with my client. So, how to do it? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 7, 2007 Share Posted November 7, 2007 not without knowing the nature of the file, odds are you are running something recursive a few million times and if that is the case just set it to run every 10 minuites and update a portion instead Quote Link to comment Share on other sites More sharing options...
mr_zhang Posted November 9, 2007 Author Share Posted November 9, 2007 Hi cooldude832, Thanks for replying. Well, it's somehow kindda spidering and indexing service like Search Engines. So the script will go to the internet and parse the content of pages of websites out there (my client owns them, don't worry about yours. For some reason, which I can't share here, they don't allow me to put any script on the existing sites to make the job easier and faster), then do it's own calculation based on those pages. I'm hoping that it could parse like millions of pages in one go. I've also set the script to sleep() here and there to reduce the server load. I guess the sleep() won't affect the run time, will it? Last time I checked it needs around 2 to 5 seconds to get one page (yes, one whole page) with file_get_contents() so it really needs a lot of time to complete. So, I'm hoping that I can split the script into smaller chunks but still run them all in one go. Any suggestion? Regards, 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.