|
Posted by andipfaff on May 13, 2008, 2:49 am
Please log in for more thread options > andipfaff wrote:
> > I want to avoid modifying all scripts for all virtual websites, and I
> > want to avoid using absolute paths for the -f function. The first one
> > is just too much work, th latter one would make the code unflexible
> > and less portable.
>
> > Is there a way to change the behaviour of Apache without touching the
> > scripts?
>
> Whether there is or not, it would defeat your portability goal.
>
> You'd better rewrite your scripts, and not rely on paths relative to the
> current directory. One common approach is to have a config file with
> absolute paths.
>
> =A0 =A0 =A0$picturepath =3D 'C:/full/path/to/pictures';
> =A0 =A0 =A0if ( -f "$picturepath/photo1.jpg" )
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl
Thanks for the answer but the portability goal is not met with your
suggestion. If I change the location where my files are stored (the
location from the point of view of the filsystem) it does no longer
work. And I would have dozens of config files with different picture
paths. The idea with getting the absolute current path while the
script is running with
-f "%ENV/pictures/photo1.jpg")
is working fine. Even if I have to change every script but that can be
done "half" automatically.
Thanks for your help.
Andi
|