I have made a PHP script which takes days to execute (Web Article Generator) and is there any way that I can make the while loops do more Instructions Per Second using php. Because when executing the script, the servers resources are very low (15% memory & about 9% of cpus) which means the server has plenty of room for a faster execution time. The only thing that I can think of so far is to have a page with 16 iframes all executing a separate while loop of the same php applet but I really need a PHP solution.
If you have any suggestions for increasing the Scripts Instructions Per Second or making the execution time faster then please post them.

ini_set('memory_limit','384M');

Surprisingly adding the line above seems to help a little but not tremendously. But is there anything which directly relates to the execution speed or speeds up the execution time to a much faster speed?

Assume you have hardware that meets to run your script.

If so,
1. Optimize your SQL.
2. Install memcache extension in PHP.

Hope it helps.

Thanks for the replies but I have just found out that it is mainly mysql query's that slow down the script big time. So I will try to use arrays and will try out memcache if memcache is a default php library.

Another option is(I've never done it before but it should work) addresses by an article that I read about six months ago regarding php multi threading. This can be done with an <img> tag. For instance, if you want to send any number of parallel threads on their own, you can create an html page with several <img src="processor.php?var1=var1value&var2=var2value" /> and then do a javascript redirect at the bottom to continue processing. It would probably take some working with to perfect the process but if used correctly could probably cut processing time drastically.

This article has been dead for over six months. Start a new discussion instead.