Question: There are 8000 html files in my `data` directory.I parsed all the html files via traversing the target directory and to call the parse function.The filename will be displayed when to be parsed in my program.

```
<?php
base_dir="c:\data";
function parse($fname){
//to parse data from the file,omitted codes
    echo $fname;
    }   

foreach(new RecursiveDirectoryIterator(base_dir) as $item){
    parse($item);
    }
?> 

```

I found that the filenames will be displayed on the web page until my whole php file was executed,the filenames will be displayed in 10 minutes ,filename is not displayed one by one when one file is pared over.
How can i display the result instantly on the web page one by one,not wait until the whole php file was finished?  

It is important for me to get the file name dispalyed that i know if there is problem in my code,if long time passed ,nothing displayed in the web page will make me nervous.

Answer: 
If you need just to trace your program execution you could use error\_log($fname) command instead of 'echo'. Less effort than AJAX and you could track execution 'live' by paste in Ubuntu terminal:

```
tail -F /var/log/apache2/error.log

```

(on other \*nix path may be different).
Do you mean showing results without refreshing webpage? 
IF that, you can use ajax to send request.