Strange PHP problem - long processing time
Moderator: General Moderators
Strange PHP problem - long processing time
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?
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?
- WaldoMonster
- Forum Contributor
- Posts: 225
- Joined: Mon Apr 19, 2004 6:19 pm
- Contact:
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.
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.
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.
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.
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.
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.
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
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
- WaldoMonster
- Forum Contributor
- Posts: 225
- Joined: Mon Apr 19, 2004 6:19 pm
- Contact:
This works for me: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
Set output_buffering = On or zlib.output_compression = On in the php.ini.
Instead of only using flush() in the scripts use:
Code: Select all
ob_flush();
flush();Code: Select all
@ob_flush();
flush();