Page 1 of 1
Strange PHP problem - long processing time
Posted: Fri Mar 04, 2005 4:48 pm
by Swede78
Whenever I add any PHP code to a page, that page takes an extra 3-5 seconds to load. I've even narrowed it down to literally being any kind of php code (ie echo 'hello'). If I don't have any PHP code, the page loads quickly. So, I'm actually pretty sure it's not the php code itself that causes the delay in loading, it's more likely the server.
This is happening on a new server that I'm testing the site on. PHP version was upgraded from 4.3.1 to 4.3.10. I wouldn't think this would add 3-5 seconds to process echo 'hello', but maybe it would.
I'm on a Windows Server 2003 with IIS6. PHP is installed as an ASAPI dll, not CGI.
Any ideas on what this lag in page loading could be?
Posted: Fri Mar 04, 2005 5:02 pm
by WaldoMonster
Edit the PHP.INI and set a value for output_buffering = xxx instead of off.
A lower value will make it slower.
And with higher value, flush() doesn't work.
Is there another solution

Posted: Fri Mar 04, 2005 5:11 pm
by Swede78
I just finished reading someone else's post who did exactly what you suggested. The strange thing is that I thought that when the output_buffering is used, it will slow the page down.
Is this an IIS6 issue? I was previously using IIS5, and this application pool is new to me, so maybe it has something to do with that. I'll first give the output buffering a try.
Posted: Fri Mar 04, 2005 5:15 pm
by feyd
have you tried regressing back to php 4.3.9 ? I've been hearing several people have problems with 4.3.10 on IIS..
Posted: Fri Mar 04, 2005 6:11 pm
by Swede78
Huh, interesting. I actually had output_buffering = 4096. I turned it off, and the page that was taking 5 seconds to load, now is taking over 10 seconds. (My older, slower server pushes it out in .5 secongs).
So, now I doubled it to 8192 - and it loads in 1 sec. Now, my question for all you out there who know anything about this... how high can I make this without using up all my memory? What's an acceptable level? And is this a proper solution for my problem?
I've been reading about the IIS5 Isolation Mode. I may try using that. Maybe that'll work. I'll post my findings.
Posted: Fri Mar 04, 2005 6:12 pm
by Swede78
I've noticed that it's still slow on pages with a lot of content. So, I probably need to raise that amount considerably to perform like my old system.
Posted: Fri Mar 04, 2005 7:36 pm
by feyd
what came of the regression test?
Posted: Fri Mar 04, 2005 11:52 pm
by anjanesh
I used PHP 4.3.x with IIS6 - yes - its slower.
With PHP 5.0 you may even get a famous error msg PHP has encountered an Access Violation at 016E73DD but that seems to be fixed - I really dont know.
Now using Apache for PHP 5.0.3 and IIS for ASP.NET with 2 different ports. I think its worth the overhead because it really slows down programming time trying to figure out incompatibility issues. Getting an extra RAM slot for many services is also worth.
Posted: Sat Mar 05, 2005 12:47 am
by smpdawg
Another person on this board had the same problem. We went over the configuation repeatedly and did various tests to try to isolate the problem. In the end the problem was as obvious as I would have expected. IIS...
Posted: Sun Mar 06, 2005 2:47 am
by Swede78
I just posted a nice really long explanation with a chart of the times for each setup I tried. I hit submit, and and accidentally closed the browser before it finished processing the post. So, this time, I'm going to really simplify it. It's almost 3am here.
I didn't try regressing to 4.3.9. - that would've been my last resort, and it proved to not be needed.
I tried turning on IIS5 Isolation Mode, and that made a significant improvement. About twice as fast as with it off.
Then I tried setting output_buffering to "= On" instead of a set number, such as 4096. This made my page take no time - averaging less than .01 seconds to load. So, I turned IIS5 Isolation Mode back off, and got the same result. So, that is the configuration I'm sticking with.
hope this helps someone
Posted: Sun May 13, 2007 4:10 am
by WaldoMonster
WaldoMonster wrote:Edit the PHP.INI and set a value for output_buffering = xxx instead of off.
A lower value will make it slower.
And with higher value, flush() doesn't work.
Is there another solution

This works for me:
Set
output_buffering = On or
zlib.output_compression = On in the php.ini.
Instead of only using
flush() in the scripts use:
If you are not certain that the script is running with
output_buffering = On or
zlib.output_compression = On you could use: