projectshifter Posted December 1, 2006 Share Posted December 1, 2006 Okay, so I've got a script that wgets a video, converts it into another format, and then generates some thumbnails for it. Before I start, I know there are going to be a lot of people saying use set_time_limit(0); to fix this problem, I've done that, this isn't PHP causing the timeout, it's apache, but because of PHP. So the thing is that it prints out that it's getting the video, then says it's done (it gets it in no time at all), and then it says it is converting the video. Some of the videos are coming out to be several hundred mb, and the time that it takes to convert them is quite long, in upwards of 10 minutes sometimes. While this is running, apache ends up dropping the connection because it thinks the server has stalled and isn't sending it anymore data (technically it isn't, but it will). This is for a client, and I've come up with a solution, the only thing that I think can get it to work properly, but he does not want to do it and wants me to look around for other ideas, which I have, but haven't gotten anything useful yet.[b]My Solution[/b]The best thing I could come up with is to do a little system of frames, one that handles the conversion and has ignore_user_abort() turned on so that even if the server drops the connection, the php script is still going to run, and then the other frame that checks the file size of the created file, waits 5-10 seconds, checks it again, and repeats until those 2 numbers match up (indicating that the video is done converting). It's ugly, and aggravating, but it's the only thing that I can figure will do the trick.[b]The Problem[/b]My solution will do it, the client doesn't want to do it that way. I've tried doing echo exec() and echo system() but it doesn't print out any of the data until it comes to it it seems, and worse is that this program prints out about zero data, although I could rig a bash file to do it if I had another way. Any thoughts would be appreciated. Link to comment https://forums.phpfreaks.com/topic/29063-timeout-problem-with-exec/ Share on other sites More sharing options...
projectshifter Posted December 1, 2006 Author Share Posted December 1, 2006 *bump* Come on guys, someone out there has to have some ideas ;) I've spent the last 3 hours going through and helping other people, there's got to be a couple people who know enough about programming to put in their two cents! Link to comment https://forums.phpfreaks.com/topic/29063-timeout-problem-with-exec/#findComment-133285 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.