You are here: Re: 'undefined function' error if I use a fully-qualifed include « PHP Programming Language « IT news, forums, messages
Re: 'undefined function' error if I use a fully-qualifed include

Posted by juglesh on 10/19/05 16:07

Puzzled wrote:
> This is a weird problem, but perhaps someone else has seen it before
> (I hope!)
>
> If I use a fully qualified include call
>
> include ( 'http://localhost/subtree/filename.php')
>
> I get an 'undefined function' error when calling a routine that's
> defined in that file.
>
> (I know the file is being included and the parser is at least seeing
> the definition because I put disclosure echos before and after the
> definition, and the echos work.)
>
> But the error goes away and the function executes if I use a relative
> reference
>
> include ('subtree/filename.php')
>
> even though subtree is *not* declared in the include_path config var
> in php.ini.

if the subtree folder is in the same folder as the current script, php
knows to look for that folder in the current folder. same as include
'filename.php', it looks in the current folder.

if you are looking to include a file relative to the main folder of
your site, try
include $_SERVER['DOCUMENT_ROOT'].'subtree/filename.php'
(you may need a slash before subtree)

--
juglesh

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация