farnoise Posted June 14, 2012 Share Posted June 14, 2012 Hello All, I have a PHP application which goes through my tables in MYSQL does some cleaning once in a while (Updating record, removing, adding, and etc..) its a PHP application that I wrote uses loop and foreach and gets executed by CroneJob on my server every 4 ~ 6 hours ( twice a day). I haven't run the application for a long time but i am expecting my tables grow in rows in the near future. Here is some concerns that I have. I have set the execution time to 5 min, in my application I have a garbage collector and I make sure that every time a single row gets affected I free up the Variables, Sessions, and etc.. at the end of each process for the row then move to the next row and repeat... (so you see if I have 900 rows, it keeps executing few commands for each row frees up everything goes to the next row till the end stops). Do you guys see any problem with this?? Again as my rows are growing I prob need to increase the Exc time since my app already running for about 3 ~ 4 minutes... Do you see any problem? Any alternatives ?? My server is Linux, Should I get into Linux commanding itself rather than PHP? (I have very little knowledge on Linux) Oh, And if you think its ok as long as i free up memory in the function, is there a way that I force PHP time to MAX ? Thanks so much, sorry for the long post Quote Link to comment https://forums.phpfreaks.com/topic/264183-php-execution-time/ Share on other sites More sharing options...
mrMarcus Posted June 14, 2012 Share Posted June 14, 2012 You can have a script run 24/7 in the background without issue. Just make sure that the script is efficient and isn't hogging valuable resources. If it does, you'll need to rewrite it so it's not even a dot on the radar. Quote Link to comment https://forums.phpfreaks.com/topic/264183-php-execution-time/#findComment-1353824 Share on other sites More sharing options...
kicken Posted June 15, 2012 Share Posted June 15, 2012 Only a couple points 1) Make sure your executing it via the PHP-CLI interface rather than through the web server. Running it through the web server just ties up a server thread and introduces additional complications. 2) You may want to add something to ensure you don't end up with multiple instances of the script running at the same time. Especially if you start increasing the max execution time higher or disable it (setting it to 0 allows a script to run indefinitely). Quote Link to comment https://forums.phpfreaks.com/topic/264183-php-execution-time/#findComment-1354063 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.