php sql cpu?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
FireElement
Forum Commoner
Posts: 86
Joined: Wed Oct 17, 2007 6:03 pm

php sql cpu?

Post 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
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

It's likely dependent on the amount of HTML being output.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
nathanr
Forum Contributor
Posts: 200
Joined: Wed Jun 07, 2006 5:46 pm

Post by nathanr »

check if output buffering is turned on and optimise your code/sql a bit more is about all you can do!
FireElement
Forum Commoner
Posts: 86
Joined: Wed Oct 17, 2007 6:03 pm

Post 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
User avatar
nathanr
Forum Contributor
Posts: 200
Joined: Wed Jun 07, 2006 5:46 pm

Post 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
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Best route is the simplify your HTML as much as possible.
User avatar
nathanr
Forum Contributor
Posts: 200
Joined: Wed Jun 07, 2006 5:46 pm

Post by nathanr »

feyd wrote:Best route is the simplify your HTML as much as possible.
and php and most importantly sql :arrow:
FireElement
Forum Commoner
Posts: 86
Joined: Wed Oct 17, 2007 6:03 pm

Post by FireElement »

Is there no way to make the page buffer while it loads all the html.
FireElement
Forum Commoner
Posts: 86
Joined: Wed Oct 17, 2007 6:03 pm

Post by FireElement »

Check out these pages and see what you think.

http://www.kenjy.com/search/
http://www.kenjy.com/share-tips/
FireElement
Forum Commoner
Posts: 86
Joined: Wed Oct 17, 2007 6:03 pm

Post 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...
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Yeah, javascript would certainly hinder the ability of a lesser-able computer to display/interact with the pages being rendered.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Post Reply