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?
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?
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...
I hope you are not doing this:
Why, yes I am. Is this bad news?
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.
Okay. Thanks for the info.
Whoever thought allowing web URL's to be used with include and require should be shot. :nono:
It also makes your code hard to move between local dev server and production one if all the absolute URLs are hard coded.
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.