Forum Moderators: coopster

Message Too Old, No Replies

Fastest way to link using <php include...

         

mark l sanders

6:37 pm on Oct 3, 2004 (gmt 0)

10+ Year Member



My ISP uses PHP in Safe Mode, so I can't quote a path from root for my PHP includes.
I would like every page that includes a file (used for top banner and side nav) to quote the same path - unfortunately Safe Mode disallows this, and I get an open_basedir restriction error.
That leaves two choices:

1) quote a relative path that, obviously, will differ depending on the 'level' of the file doing the quoting

2) quote an absolute path using [whatever.com...] for example.

The advantage of the second option is that the quoted path is the same no matter the level of the source file.

Does anyone know if there'll be any load-speed implications?

thanks

davelms

8:01 pm on Oct 3, 2004 (gmt 0)

10+ Year Member



I wasn't forced to any one solution like you are, but when I was learning I found that with option (2) the include request came out in the Apache server logs. Basically I couldn't quite understand why I was getting thousands of hits from the same IP address for what was essentially an internal script. And then it became obvious, the IP address was my own website, and everything 'disappeared' when I changed it around. Basically, what I am saying in a roundabout sort of a way is that my belief if that there must be something of an overhead of (2) even if it is negligible...

Code Sentinel

1:32 am on Oct 4, 2004 (gmt 0)

10+ Year Member



I use $_SERVER['DOCUMENT_ROOT']

ex: include($_SERVER['DOCUMENT_ROOT'].'/includethis.inc');

ergophobe

9:54 pm on Oct 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Code Sentinel has it right. You do not want to use a URL and include via the webserver as that is an order of magnitude slower than using the file system.

mark l sanders

9:18 am on Oct 5, 2004 (gmt 0)

10+ Year Member



Thanks very much to all. I have tested/implemented/been overjoyed by Code Sentinel's suggestion.
Again thanks