level9wizard
asked on
Include path with ./ in PHP
If I have an index.php in say:
c:\wamp\www\myfolder\index .php
that is calling an include() in a sub directory say:
include_once('subfolder\fi le.php') which translates into c:\wamp\www\myfolder\subfo lder\file. php
and inside file.php it is calling an include like:
include_once('./different_ file.php') ;
then it goes back to c:\wamp\www\myfolder\ to try and find it . How can I force it so that include('./anything.php') stays inside the most recent folder it was called from, and not the first?
NOTE: It's important to know that I can't edit file.php, It has to maintain it's include with the ./
c:\wamp\www\myfolder\index
that is calling an include() in a sub directory say:
include_once('subfolder\fi
and inside file.php it is calling an include like:
include_once('./different_
then it goes back to c:\wamp\www\myfolder\ to try and find it . How can I force it so that include('./anything.php') stays inside the most recent folder it was called from, and not the first?
NOTE: It's important to know that I can't edit file.php, It has to maintain it's include with the ./
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> and inside file.php it is calling an include like:
include_once('./different_ file.php') ;
if u cant edit file.php, how did u know whats inside that file ?
include_once('./different_
if u cant edit file.php, how did u know whats inside that file ?
the option is place different_file.php in c:\wamp\www\myfolder
>> I can't edit file.php
My suggestion involved editing index.php only...
My suggestion involved editing index.php only...
ASKER
>> My suggestion involved editing index.php only...
Yea sorry I didn't reply to your first remarks properly - In fact you've solved it really. I'll likely have to ask another question based on this one however.
Yea sorry I didn't reply to your first remarks properly - In fact you've solved it really. I'll likely have to ask another question based on this one however.
ASKER
Problem is, as you saw above, I can't edit file.php - I will consider how I might be able to access this from outside though.