Page 1 of 1

php sql cpu?

Posted: Tue Dec 11, 2007 9:38 am
by FireElement
Hi,

I went to my mums house yesterday and she has well a slow computer she has rubish cpu and not much ram. I noticed when I tried to load two pages that I know have lot of php code and sql code it was failing to load them the page would end up just been grey so I checked source and it was like half the page had loaded.

I was wondering if there is away to make the page load slower with lots of code for slow computers. To be honest I not sure where to look, well mainly like an a** I presummed that if the connection was fast the php would load fine. Obviously they need a fast processor aswel in some cases.

Can anyone help me understand whats going wrong so I can fix it?

Thanks

Posted: Tue Dec 11, 2007 9:41 am
by s.dot
It's likely dependent on the amount of HTML being output.

Posted: Tue Dec 11, 2007 9:46 am
by nathanr
check if output buffering is turned on and optimise your code/sql a bit more is about all you can do!

Posted: Tue Dec 11, 2007 10:54 am
by FireElement
Alright I looked up ob_flush. Basically I was not using a buffer. Do you think if I use a buffer, this will make the page load everytime?

http://uk.php.net/ob_start

Posted: Tue Dec 11, 2007 10:58 am
by nathanr
alas, no you definately do not want to turn it on.. you do need to check that implicit_flush is not set to 1/true in php.ini though, and that's what I meant the first time but didn't make myself quite clear enough!

http://uk.php.net/manual/en/ref.outcontrol.php

Posted: Tue Dec 11, 2007 11:00 am
by s.dot
No. In the end, the end computer still has to display the same amount of output.

PHP is on a remote server (unless you are talking about localhost issues). It doesn't matter that the end computer is slow. The page will get generated on the server as fast as it would on any computer you're using to access it. It's up to the end computer to handle the output.

As far as your moms computer goes, it doesn't know if the HTML was generated by PHP or if it's a static HTML page.

Posted: Tue Dec 11, 2007 11:09 am
by feyd
Best route is the simplify your HTML as much as possible.

Posted: Tue Dec 11, 2007 11:10 am
by nathanr
feyd wrote:Best route is the simplify your HTML as much as possible.
and php and most importantly sql :arrow:

Posted: Tue Dec 11, 2007 11:49 am
by FireElement
Is there no way to make the page buffer while it loads all the html.

Posted: Tue Dec 11, 2007 11:52 am
by FireElement
Check out these pages and see what you think.

http://www.kenjy.com/search/
http://www.kenjy.com/share-tips/

Posted: Tue Dec 11, 2007 12:04 pm
by FireElement
Yeah your right I realised maybe the pages could not cope with the amount of javascript I output via php in a script I wrote do you think a javascript buffer would work... maybe I should revert back to php and refresh...

Posted: Tue Dec 11, 2007 12:27 pm
by s.dot
Yeah, javascript would certainly hinder the ability of a lesser-able computer to display/interact with the pages being rendered.