marksponge02 Posted May 18, 2006 Share Posted May 18, 2006 I have a website that deals with lots of information.At the moment I have apage that builds an excel spreadsheet using information from my mysql database.This is ok with small amounts of data, it shows a blank page while it builds the report. I am having trouble with large amounts of data. The report can take up to 2 hours to be built and if I close the browser window the report doesn't get built.I have seen sites where you can set a report going and close all browser windows then recieve an email when the report is ready.How can I do this?I know how to send emails and save files to the server but how do I do it if the user closes the browser window?To sum up: How do I set a PHP script running where if the user closes the browser window the script continues to run until it finishes?Thanks in advance.Mark Quote Link to comment https://forums.phpfreaks.com/topic/9943-php-expert-needed-with-solution/ Share on other sites More sharing options...
ober Posted May 18, 2006 Share Posted May 18, 2006 Chances are they're not using PHP to do that. They're firing off some system-based software that builds the report for you. Quote Link to comment https://forums.phpfreaks.com/topic/9943-php-expert-needed-with-solution/#findComment-36953 Share on other sites More sharing options...
marksponge02 Posted May 18, 2006 Author Share Posted May 18, 2006 So there is no way of running a server side script without using a browser, manual command promt or cron job?Can I not post to a hidden page?Just guessing now :) Quote Link to comment https://forums.phpfreaks.com/topic/9943-php-expert-needed-with-solution/#findComment-36955 Share on other sites More sharing options...
ober Posted May 18, 2006 Share Posted May 18, 2006 I don't honestly know to tell you the truth, but I'm about 96% sure that calling a PHP script via webbrowser would pretty much kill it if you just decided not to provide a return path for the results.... that may not be an exactly accurate description of why it would die, but I can't come up with the right wording at the moment.It can't hurt to try, but it appears that you've done that, without a positive result. Quote Link to comment https://forums.phpfreaks.com/topic/9943-php-expert-needed-with-solution/#findComment-36958 Share on other sites More sharing options...
marksponge02 Posted May 18, 2006 Author Share Posted May 18, 2006 OK thanks for the help anyway.You don't happen to know any server based software packages with this capability do you?I've googled it with not much success. Quote Link to comment https://forums.phpfreaks.com/topic/9943-php-expert-needed-with-solution/#findComment-36961 Share on other sites More sharing options...
ober Posted May 18, 2006 Share Posted May 18, 2006 Not off the top of my head. And I'd keep an eye on this thread if I were you. There are a few other members on here that probably have some experience in this arena that may be able to help you out. Quote Link to comment https://forums.phpfreaks.com/topic/9943-php-expert-needed-with-solution/#findComment-36965 Share on other sites More sharing options...
marksponge02 Posted May 18, 2006 Author Share Posted May 18, 2006 Thread bookmarked :)Thanks ober. Quote Link to comment https://forums.phpfreaks.com/topic/9943-php-expert-needed-with-solution/#findComment-36966 Share on other sites More sharing options...
shoz Posted May 18, 2006 Share Posted May 18, 2006 [quote]So there is no way of running a server side script without using a browser, manual command promt or cron job?[/quote]If this is something you want to run manually whenever you choose, then you can run it via the command prompt. You can [a href=\"http://www.php.net/manual/en/features.commandline.php\" target=\"_blank\"]use PHP from the command line[/a], running the script yourself or using a cronjob.If no user input is required and no APACHE variables are used, then you can run the script as is.[code]]$ php /file/path/to/script.php[/code] Quote Link to comment https://forums.phpfreaks.com/topic/9943-php-expert-needed-with-solution/#findComment-36969 Share on other sites More sharing options...
marksponge02 Posted May 18, 2006 Author Share Posted May 18, 2006 [!--quoteo(post=375015:date=May 18 2006, 12:58 PM:name=MarkSponger)--][div class=\'quotetop\']QUOTE(MarkSponger @ May 18 2006, 12:58 PM) [snapback]375015[/snapback][/div][div class=\'quotemain\'][!--quotec--]So there is no way of running a server side script without using a browser, manual command promt or cron job?[/quote]Thanks for your help but I already explored that avenue.I need to set the report going in a web browser and leave it going.Unless I want to write my own linux app I think I'll use cron jobs and mysql. Quote Link to comment https://forums.phpfreaks.com/topic/9943-php-expert-needed-with-solution/#findComment-36973 Share on other sites More sharing options...
shoz Posted May 18, 2006 Share Posted May 18, 2006 [quote]Thanks for your help but I already explored that avenue.I need to set the report going in a web browser and leave it going.Unless I want to write my own linux app I think I'll use cron jobs and mysql.[/quote]I've tried to understand, but I still don't follow. If you're going to run this using a cronjob you should be able to run it manually using bash or similar shell. There's no need to write a linux app. Look at the page I linked to above for more info on running php via the command line.Using a cronjob was mentioned btw.[quote]You can use PHP from the command line, running the script yourself or using a cronjob.[/quote]If you have to start the script using a browser then to run it in the background you can try using one of the program execution functions such as [a href=\"http://www.php.net/manual/en/function.exec.php\" target=\"_blank\"]exec[/a] and put the process in the background. Again however, you'll need to run the script using the php binary.[code]php /path/to/file.php &> /dev/null &[/code] Quote Link to comment https://forums.phpfreaks.com/topic/9943-php-expert-needed-with-solution/#findComment-36976 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.