Do you have a question? Post it now! No Registration Necessary. Now with pictures!
January 28, 2009, 7:11 am
rate this thread
library (which is where the real code/data is) might be in one of two
places, outside the webroot if I can set it there, or inside the webroot
if I can't
so I've been hand editing the include path
so it's either
Now, I'm not too worried about having a path that isn't visible from
the web, but I wonder what precautions I need to take if my library is
say: $_SERVER['DOCUMENT_ROOT'] . '/library';
Largely what's in there is either classes, a config file with constants
and settings, and some serialized data.
Also, it's a pain to have to change the paths
Any disadvantage to just having both:
or should I do something like:
and how should I test for that, perhaps empty?
Or should I not worry about this? Viewing these paths from a browser
gives me either nothing or an internal server error for the serialized data.
Re: multiple set_include_path
1) Isn't setting the includepath to the right directory part of
installing your application? Why do you want to automate it?
How are you delivering your application? Where do you put your lib?
I mean: if you place your lib somewhere, how much trouble can it be to
set the includepath to the right spot? 1 minute?
2) How bad is it when your files in the lib are accessable?
All my libfiles are PHP files (with a php extension) and they contain:
a) Class definitions
Both can be called directly by anybody without any effect. They won't
see the source, nor execute any code.
What are you putting in your libs?
But if you must do it the way you described, I would check if a file
exists in both positions the lib can be, and pick the first that holds
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare