Re: Question about includes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Brady Mitchell wrote:
On Tue, Nov 24, 2009 at 6:22 AM, Al <news@xxxxxxxxxxxxx> wrote:
This bothers since the current working directory is effectively where my
original script resides; is it not? If so, doesn't the "include Net/SMTP.php
on line 206" look for the path relative to it and not in
/home1/youstart/php/?

When including a file with a relative path PHP starts at the beginning
of the include_path and checks each directory until it finds the file
or reaches the end of the list. In this case it will start with the
current directory since you've got the . as the first entry in the
include path.

When using relative paths, it's relative to the script with the
include statement. So if you have a script myscript.php that includes
mail.php, that include will be relative to myscript.php. Then when you
include smtp.php from mail.php, the relative path will be relative to
mail.php, not myscript.php.

It looks like you're using PEAR classes, but the pear directory isn't
in the include path. Try adding that path to your include_path by
editing your .htaccess or using ini_set().

HTH,

Brady

Thanks Brady. That's a clear explanation and most helpful. The PHP manual could use a better description like your's.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux