todd_temple — 2011-02-09T13:34:16-05:00 — #1
I have added two includes to load a header and footer via PHP and since I have added these includes the page loads incredibly slow. Is there an issue with page loading times when adding includes?
Here is a link to the page I am referring to...
Or is this a host issue?
oddz — 2011-02-09T13:39:48-05:00 — #2
Two includes themselves would not be a noticeable difference but the code within them may cause the issue. What is being done within each including – fetching remote content perhaps?
todd_temple — 2011-02-09T13:54:31-05:00 — #3
Not really fetching remote content... I don't guess. It is simply loading a menu or navigation for each.
I am on the phone with the web hosting provider and they commented that I should not have absolute URLs in my include files and that I should change them to relative URLs. Would that help? That doesn't sound correct...
logic_earth — 2011-02-09T14:40:19-05:00 — #4
I hope you are not doing this:
todd_temple — 2011-02-09T14:51:27-05:00 — #5
Why, yes I am. Is this bad news?
logic_earth — 2011-02-09T14:54:31-05:00 — #6
It is very bad. You are making PHP go out to the internet, it needs to connect to a DNS server to get the IP, then send out network request to establish a connection to the server, download the requested file...etc.
Use file paths (like you do for files on your computer), not URLs to access files with PHP.
todd_temple — 2011-02-09T14:57:40-05:00 — #7
Okay. Thanks for the info.
michael_morris1 — 2011-02-09T15:38:14-05:00 — #8
Whoever thought allowing web URL's to be used with include and require should be shot. :nono:
cranial_bore — 2011-02-09T16:17:36-05:00 — #9
It also makes your code hard to move between local dev server and production one if all the absolute URLs are hard coded.
michael_morris1 — 2011-02-09T16:43:20-05:00 — #10
Yeah, but honestly it was just an awesomely stupid idea, right up there with register globals and magic quotes. PHP is a good language, but damn if it doesn't have some terrible mistakes in its past.