Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-02-2006, 02:49 PM   PM User | #1
tk5ep
New to the CF scene

 
Join Date: Jan 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
tk5ep is an unknown quantity at this point
Bufferering or background task ? .. help !

Hi all,

I have a script that calls another one which has a loop that reads a huge file (mine actualy 14 Mb) and reads it line by line (actualy 55000), parses them and makes an INSERT in a MySQL database.
The file can even be larger ...

At start of script i display a short info and normaly each time an error is detected in a line, it should diplay a warning.
At the end of script, i display the result : number of line inserted and number of errors.

If everything works ok on small files (about several thousand of lines) i do have a problem on large files. The execution time (70-80 s) is beyond time out of server and browser. It also depends on what server it runs.
In some configuration, nothing is displayed until end of script, with others the begining is displayed than nothing, sometimes it timeouts and nothing is done.

How can i make the script run in background and/or display a progress bar or something that would warn the client that something happens ?

I tried to send a == to the browser at x loops but that does not solve my problem. I tried to optimize evrything i could in parsing and MySQL command... (can't use LOAD DATA INFILE due to server restrictions)

Every help is welcome.
A happy new year to all readers.
tk5ep is offline   Reply With Quote
Old 01-02-2006, 04:27 PM   PM User | #2
Mithrilhall
New to the CF scene

 
Join Date: Dec 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Mithrilhall is an unknown quantity at this point
Do you have access to the php.ini file? If so you could change the timeout setting.

Also, why not diplay an image to the user while your page is doing it's thing?
http://mentalized.net/activity-indicators/

This might help as well....http://us3.php.net/flush


Check out some ajax examples as I think they would work for you here.
http://rajshekhar.net/blog/archives/...-Tutorial.html
Mithrilhall is offline   Reply With Quote
Old 01-02-2006, 04:43 PM   PM User | #3
tk5ep
New to the CF scene

 
Join Date: Jan 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
tk5ep is an unknown quantity at this point
Thanks for answer.

I forgot to tell that i could not manage to make flush() work in my script, even if it should !! No way...

I will have a look on AJAX page you gave me. It seems that AJAX is the future... I use it intensively every day ! But as a customer in GMAIL.

Thanks for the nice pictures, i can use them but the problem is that my script is timing out if i do nothing !

Patrick,

Quote:
Originally Posted by Mithrilhall
Do you have access to the php.ini file? If so you could change the timeout setting.

Also, why not diplay an image to the user while your page is doing it's thing?
http://mentalized.net/activity-indicators/

This might help as well....http://us3.php.net/flush


Check out some ajax examples as I think they would work for you here.
http://rajshekhar.net/blog/archives/...-Tutorial.html
tk5ep is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:41 AM.


Advertisement
Log in to turn off these ads.