Webmaster, I don't know your programming background, so I'll assume you're not above the 2 standard deviation mark of webmasters and assume you're not up to speed on order of complexity in algorithms.
Your script, somehow, is too high a complexity order for the data you allow. Your script complexity may be O(n^2) or higher, when it should be NO MORE than O(n*lg(n)), O(n), or O(lg(n)).