You are here: Re: [PHP] Re: Include wierdness. « PHP « IT news, forums, messages
Re: [PHP] Re: Include wierdness.

Posted by Rob Adams on 03/04/05 18:18

The scenario I gave is very simplified. I'm actually trying to get tikiwiki
working on a server, and the reason it won't run the install is because of
this problem I've mentioned. It works as expected on my development server
(WinXP), but on my production (FreeBSD) it fails.

I don't have a /www/include dir. The reference to that is just from the
manual that I quoted.

-- Rob


"Jochem Maas" <jochem@iamjochem.com> wrote in message
news:42288954.2070909@iamjochem.com...
> Rob Adams wrote:
>> One correction. The include('lib/test2.php') is actually a
>> require_once('lib/test2.php'). That's why it quits and I don't get the
>> third include.
>
> you 100% sure your include_path is '.' ? just asking.
> also you mention a /www/lib and a /www/include dir - maybe thats
> the problem?
>
> maybe you can make the problem go away by setting include_path to
> '.:/www/include' or '.:/www/lib'
>
> I must say I think its overkill to use file_exists() on files
> you are going to require_once() - although no doubt there is a good
> reason to do it sometimes :-)
>
> it is odd though, file_exists() returns true yet the file cannot
> be included.
>
> --
> any chocolate chips in this cookie jar care to enlighten the crumbs?
>
>
>>
>> -- Rob
>>
>>
>> "Rob Adams" <rob_adams@hotmail.com> wrote in message
>> news:20050304155533.31138.qmail@lists.php.net...
>>
>>>From the manual on 'include':
>>>
>>>"Files for including are first looked in include_path relative to the
>>>current working directory and then in include_path relative to the
>>>directory of current script. E.g. if your include_path is ., current
>>>working directory is /www/, you included include/a.php and there is
>>>include "b.php" in that file, b.php is first looked in /www/ and then in
>>>/www/include/."
>>>
>>>I have a file in my root dir (we'll call it /www) that includes the file
>>>/www/lib/test.php as follows:
>>>include('lib/test.php');
>>>
>>>test.php looks like this:
>>><?
>>> echo 'Inside first included file.';
>>> if (file_exists('lib/test2.php'))
>>> echo 'This file exists.';
>>> include('lib/test2.php');
>>> echo 'Ending first included file.';
>>>?>
>>>
>>>/www/lib/test2.php exists. Whenever I run this, I get the first two echo
>>>statements, without getting the third one. The error log reports that it
>>>couldn't find lib/test2.php. If I take out the 'lib/' in the include
>>>statement, it works. According to the description from the manual,
>>>either way should work. Has anyone ever come across this problem before,
>>>and is there a config setting that causes it? I'm stumped here, and I
>>>refuse to go change all the code when from what I've read it should
>>>already be working.
>>>
>>> -- Rob
>>

 

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

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