I have a php script that is looping on a huge directory of data. What it does is looping through record ids, if it doesn't find anything useful, it increment the id and redirect to same page with new id. I want to force run this script to get the data for me, but after every 20 records, its stopping and giving error that this script is not redirecting properly. is there any way of altering php.ini file using which I can force this script. Its running as it is supposed to run and its supposed to redirect like that.
2 Answers
You are hitting the HTTP redirect limit. The default for Firefox is 20.
You could use a meta redirect or a Javascript redirect, which are exempt from this limit.
Comments
It sounds like your use case should use PHP CLI with a main while/for loop, rather than redirecting to itself.
Of course, you could use a main while/for loop in the browser as well and just set_time_limit(0) to remove the time limit restriction.
It's also worth noting that the limitation you're seeing is enforced by your browser, not by your web server, so modifying php.ini will not affect this.
2 Comments
Sourabh
no, in that case, I wont be able to check the progress of my script, i want to monitor how many records it has processed. every time it finds a useful record, it prints the results. so I thought redirecting would be a good option
dtbarne
How do you figure? Just print out progress during each iteration of the loop.