How to identify Apache/PHP directive that works on XAMP

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How to identify Apache/PHP directive that works on XAMP

Postby TomXampp » 26. December 2015 01:29

This should be an interesting question, as I'm trying to determine what default configurations of XAMPP are allowing a certain desired behavior on my site when served on XAMPP localhost that I can't reproduce on the live server (i.e., XAMPP does it *right*, or at least as I prefer, and the live server does it *incorrectly*.)

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
@apache_setenv('no-gzip', 1);
@ini_set('implicit_flush', 1);
@ini_set('output_buffering', 'Off');
ob_implicit_flush(1);


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.

Many thanks!
TomXampp
 
Posts: 59
Joined: 12. March 2015 03:58
Operating System: Windows 8.1

Re: How to identify Apache/PHP directive that works on XAMP

Postby JJ_Tagy » 26. December 2015 14:24

I think the first thing I would do is a phpinfo() on both systems to see what (if any) differences.
JJ_Tagy
 
Posts: 788
Joined: 30. January 2012 13:44
XAMPP version: 5.5.15
Operating System: Windows 10 Pro x64

Re: How to identify Apache/PHP directive that works on XAMP

Postby Nobbie » 26. December 2015 17:08

Did you look into the error log?
Nobbie
 
Posts: 13171
Joined: 09. March 2008 13:04

Re: How to identify Apache/PHP directive that works on XAMP

Postby TomXampp » 26. December 2015 17:18

I did compare the phpinfo of both systems and all of the obvious settings to examine were identical; also, no errors were reported in any of the log files.

My current theory is that it has to do with FastCGI being enabled on my live server. I'm going to switch it to regular CGI and try that.

http://www.fastcgi.com/archives/fastcgi-developers/2009-June/000265.html
TomXampp
 
Posts: 59
Joined: 12. March 2015 03:58
Operating System: Windows 8.1

Re: How to identify Apache/PHP directive that works on XAMP

Postby JJ_Tagy » 26. December 2015 17:36

And the PHP version is exactly the same major/minor?
JJ_Tagy
 
Posts: 788
Joined: 30. January 2012 13:44
XAMPP version: 5.5.15
Operating System: Windows 10 Pro x64

Re: How to identify Apache/PHP directive that works on XAMP

Postby TomXampp » 26. December 2015 17:40

Yes. PHP 5.6. And the behavior is the same when I try it on XAMPP with PHP 7, i.e. XAMPP PHP 5.6 and PHP 7 do not buffer the script but simply output each item as it's read and interpreted, which is the desired behavior.
TomXampp
 
Posts: 59
Joined: 12. March 2015 03:58
Operating System: Windows 8.1


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 110 guests