Slow php include


Just moved to DH and found a slowness problem. Every php include() which opens a URL (to its own server) makes the page load extremely slowly. I didn’t seem to experience this issue with my previous host.

Speed is great when include()ing through the local file system. The reason I’m using URL is because I need to pass arguments into the script (e.g. a counter perl script) which gets the input from the URL query string.

include(‘’); --> doesn’t work, of course
include(‘’); --> works but extremely slow

Any tips on improving the speed?


Instead of using a relative or remote path, try using an absolute path instead. For example:

Simon Jessey
Keystone Websites | si-blog


Doesn’t work when there’s a query at the end. It can’t find a file called “”.


Including files using http:// is slow because it causes an extra hit on your web site.

You might want to find a native PHP counter script, or something that will let you count without loading a new page.

Maybe there’s some way you could call this Perl script with exec() instead.


OK, I’ve whipped up a PHP script that returns the counter in a function call. The page renders 10 times faster now.