Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with set_include_path

Status
Not open for further replies.

southbeach

Programmer
Jan 22, 2008
879
US
The problem may not be with PHP at all but with me understanding what I am doing and how it is meant to be done! ;-)

I have this
Code:
set_include_path(
    __DIR__.'/'
    .PATH_SEPARATOR.
    __DIR__.'/include/'
    .PATH_SEPARATOR.
    __DIR__ . '/include/ar/'
    . PATH_SEPARATOR .
    __DIR__.'/include/ci/'
    .PATH_SEPARATOR.
    __DIR__.'/include/gl/'
    .PATH_SEPARATOR.
    __DIR__.'/include/in/'
    .PATH_SEPARATOR.
    __DIR__.'/include/pf/'
    .PATH_SEPARATOR.
    __DIR__.'/include/setup/'
    .PATH_SEPARATOR.
    __DIR__.'/include/so/'
    .PATH_SEPARATOR.
    __DIR__.'/ajax/'
    .PATH_SEPARATOR.
    __DIR__.'/ajax/setup/'
    .PATH_SEPARATOR.
    __DIR__.'/common/'
);
which translates to
Code:
./:/home/name/public_html/name.com/:/home/name/public_html/name.com/include/:/home/name/public_html/name.com/include/ar/:/home/name/public_html/name.com/include/ci/:/home/name/public_html/name.com/include/gl/:/home/name/public_html/name.com/include/in/:/home/name/public_html/name.com/include/pf/:/home/name/public_html/name.com/include/setup/:/home/name/public_html/name.com/include/so/:/home/name/public_html/name.com/ajax/:/home/name/public_html/name.com/ajax/setup/:/home/name/public_html/name.com/common/

I then use a simple
Code:
include_once('common.php');
which is a script found within
Code:
/home/name/public_html/name.com/common/

but I am getting an error

Code:
<b>Warning</b>:  include_once(common.php): failed to open stream: No such file or directory in <b>/home
/name/public_html/name.com/ajax/ajaxControl.php</b> on line <b>39</b><br />

What am I doing wrong?

I have never used this approach and just edited a lot of scripts - would hate to reverse my decision. :-(

Thank you all in advance for your assistance!






--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
Replaced __DIR__ with $_SERVER["CONTEXT_DOCUMENT_ROOT"] and that fixed the problem.

Of course, root cause is now obvious. ;-)

That being said, if my solution is NOT a real solution, please do advise.

--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
That being said, if my solution is NOT a real solution, please do advise.


Knowing exactly what you ARE trying to do would help in determining that.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top