Sharky01276 Posted February 5, 2007 Share Posted February 5, 2007 I have a piece of code that takes a long time to run, just over one min. I want to be able to force php to redirect to another page and keep this code running in the background. I have tried using header("Location: http://192.168.96.110/lcr/callhandlingmaint.php"); But the redirect is only run after the one minuite of code has taken place. Any ideas or suggestions. Thanks in advance Alan Link to comment https://forums.phpfreaks.com/topic/37136-forcing-a-redirect/ Share on other sites More sharing options...
phat_hip_prog Posted February 5, 2007 Share Posted February 5, 2007 Not sure how you intend to reply, but you could use some form of 'eval' to start a system process in a seperate thread, for example if your logging etc... Link to comment https://forums.phpfreaks.com/topic/37136-forcing-a-redirect/#findComment-177350 Share on other sites More sharing options...
obsidian Posted February 5, 2007 Share Posted February 5, 2007 Sharky, when you run a header redirect, you're actually messing with the HTTP headers, so this code will not be processed until the header information starts being passed through to the browser (in other words, when your PHP is through being processed). So, you'll have to find another way to get it done. If you're simply wanting to trigger a background operation to run, I'd recommend using some sort of AJAX (Javascript HTTP Request) to get the background activity started. That way, you are, in essence, running it as a completely separate server call from what the user is currently viewing. Link to comment https://forums.phpfreaks.com/topic/37136-forcing-a-redirect/#findComment-177353 Share on other sites More sharing options...
Sharky01276 Posted February 5, 2007 Author Share Posted February 5, 2007 Thank you for your replys. Never used ajax so not sure. I have some exec and forc thing being talked about in the office, not sure how thats going to work tho Link to comment https://forums.phpfreaks.com/topic/37136-forcing-a-redirect/#findComment-177391 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.