tags:

views:

187

answers:

11

Hi,

I am new to PHP. I have developed one application using Oracle DB as backend . The PHP contains the templates, CSS and normal queries to retrieve data and display using templates. In almost all browsers, the main page display seems to be very slow. Of course, there are quite none of the records it has to process. What's more it has to display the records in the tabular columns using templates based on a filter. In Firefox it takes 30 secs whereas in IE6 or other browsers it takes 3-4 mins. Is there something which I have to check in my code or is it a browser related issue? Please let me know if you need any other details.

Thanks in advance

Best regards

Shiva

A: 

The problem will not likely be the browser, the problem will most likely be your PHP code.

The php is equal for IE and Firefox. How can it be slower for the one or the other?
xtofl
@xtofl, run page with database hit in IE, database cache is set, page runs for 3 minutes. run same page with same database hit in FireFox, database uses cache, and runs in 30 seconds.
KM
That would mean that running the page in IE twice would yield 30 seconds, the second time. OP makes no mention of that, though it would be possible.
xtofl
+7  A: 

PHP code does not execute in the browser, it executes on your webserver. The browser only receives the data after it has been processed by the webserver.

The only code that executes in your browser is javascript/ecmascript (vbscript & jscript as well for IE).

If you paste some of your code perhaps we can try to determine why it is executing slowly.

free-dom
+1  A: 

By your description, the problem could be found in either the php code, the java script code or simply in the fact that you may have too many css, js, or image files to load.

We need more data. What does the php do? Maybe a long running db query?

EDIT As it seems that my post caused some flames for proposing that the PHP could cause slow loading, I have to clarify:

  • first, 30 seconds load time in Firefox IS slow (IE is known to load slower than FF)
  • second, depending on how the php code is written, some of the rendered content may be sent to the browser before the whole page is completely rendered (partial rendering) which may exhibit different behaviors on different browsers
  • in my post, I was asking for details about what exactly happens on the page to determine whether the problem may be in PHP or somewhere else (poor Javascript)

At any rate, just reading the post again, it seems that the culprit is a series of very long tabular data which is rendered on the page. It may just be that there are too many such table rows, or that there is some javascript code that runs to generate the tables or that is attached to these tables which slows the rendering of the page to a crawl.

Miky Dinescu
the php code would be equal for IE and Firefox, wouldn't it?
xtofl
yes - the php is the same, but the rendered page could be causing the slow load. Firefox is an order of magnitude faster than IE after all - and it still takes 30 seconds to load (which is NOT quick)
Miky Dinescu
+1  A: 

do a code profiling to find bottlenecks. google for simple profilers or check this one: http://particletree.com/examples/pqp/

dusoft
A: 

If there are lots of records, try to structure your code so that it only gets the data necessary. Don't download everything and process it yourself. 9 times out of 10 it will be slower that way.

graham.reeds
+1  A: 

Under no circumstances should a website be taking 30 seconds to load, much less 3-4 minutes. There is something severely wrong with your code.

  • Are you querying the database more than once? (Database interaction is slow)
  • Are you processing the data in your query or in PHP (hint: this should be in the query/database side)
Corey D
A: 

Any page that takes 30 seconds is super slow, and it is not the browser. I'd ask some new questions about your PHP/databse code (don't forget to provide some of your code as examples) to find out what is going wrong.

KM
+1  A: 

PHP code executes on the server side, so this shouldn't be the problem (Note that PHP could still be the problem). One thing that could be the problem is the templates returning very complicated deeply nested HTML. I.e. IE has difficulty's rendering deeply nested large tables. You should check you HTML to see how complicated it is.

Note that it still is possible (and likely) that part of your problems are on the PHP side.

Pim Jager
A: 

We have noticed a similar things when displaying similar data when it gets to several hundred rows of tabular data. FF displays it much more quickly. Using tools (like mysql Administrator in our case) to see where the processing on the server is slow, shows that all of the data has been returned to the browser, but it still hasn't been displayed. We are using HTML tables to display the data and I think IE is much less efficient than FF in displaying large tables...

There may be nothing you can do except reduce the number of rows displayed in the browser.

For comparison, we have our database running on a VMWare ESX box with dual virtual procs. LAMP is the backend. When returning 6000 rows x 8 columns worth of tabular data, it can take up to 130 seconds for the browser to process and display.

Scott Lundberg
Pagination FTW.
Adriano Varoli Piazza
Agreed. Our users wanted to wait Vs. clicking next page 60 times.
Scott Lundberg
Hey, if your users choose it, ok.
Adriano Varoli Piazza
A: 

Most likely you are trying to display a lot of information and Firefox is doing progressive rendering of the tables.

voyager
A: 

I suspect that your page consists of a very large table and that some browsers are rendering it incrementally (and adjusting its size as it goes) and others are waiting for the whole table to download before rendering it.

This would create the illusion that it is loading at different speeds (although adjusting the cell sizes on the fly could slow things down).

Use a fixed table-layout to cause all CSS supporting browsers to render the table incrementally and not adjust the cell widths on the fly.

David Dorward