I have a processing script that has several blocks of PHP routines in between styled content (HTML, CSS, etc.) There are messages echoed to the screen at the completion of each of the PHP functions, and it is very helpful to have them. Each routine is dependent on values established earlier, so it is ideal for everything to be in one file.
When I serve the site on localhost via XAMPP, the page is rendered in consecutive order of the elements in the script. Therefore, the heading of the page appears first, and then, importantly, progress messages are echoed to the screen as each PHP routine is completed. This works perfectly.
When I serve the site on my live server, however, the server waits until everything is processed in the script before displaying it. The configurations of the live host and XAMPP seem identical, with GZIP enabled on both, output_buffering set to 4096, etc. However, I can't determine what XAMPP is doing *right* that my live server is doing *wrong*.
I've scoured the internet to examine similar problems and solutions. One thing that looked promising was this block of code, which I inserted at the top of the script:
- Code: Select all
With this added, XAMPP renders the page progressively (consecutively, synchronously) before it is fully processed--just as it did *without* those directives--yet the live server this time simply goes to a blank page and does not process the script at all. Perhaps this is a clue.
I'm happy to post the various configuration settings reported by PhpInfo.php on XAMPP vs those on the live server, if that would help; there's very little I've changed in the PHP.INI file in XAMPP, so I doubt it's that (and no PHP errors are reported in either case), so I suspect it's an Apache directive that is set differently on XAMPP by default than what is set on Apache at the live server.
I'm fully aware that AJAX calls can be made to accomplish this, however, if there's a way to effect what XAMPP is doing by default here (or by dint of what I may have configured specially in XAMPP), I'd prefer to go that route, as each function in the script for which I want a real-time status report is dependent on variables set by previous functions, etc., and it'd be better to leave it as one integral processing script than break it up into a sequence of AJAX calls.
I hope something I've written rings a bell with someone, or someone can offer a suggestion as to what I might try.