RE: [PHP] Problem occurs when included file includes anther file.

From: Date: Fri, 08 Aug 2003 07:06:34 +0000
Subject: RE: [PHP] Problem occurs when included file includes anther file.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-158789@lists.php.net to get a copy of this message
Thank you for your reply first. Yes I know I could set include_path either in the php.ini or at runtime.But it's a little bit dirty I think.What I am confused about is the fact that require("./inc.php") can not work while require("inc.php"); works correctly. How does php determine the include_path in this kind of situation? -----Original Message----- From: Nicholas Robinson [mailto:npr@bottlehall.freeserve.co.uk] Sent: Friday, August 08, 2003 2:54 PM To: CaiYongzhou; Php General Subject: Re: [PHP] Problem occurs when included file includes anther file. You can set the path(s) in php.ini Edit the file and search on 'include' HTH Nick On Friday 08 Aug 2003 6:38 am, CaiYongzhou wrote: > The directory structure is as follows: > / > > |-- demo.php > |-- inc/ > | > |-- inc1.php > |-- inc2.php > > === file demo.php == > <?php > require 'inc/inc1.php'; > ?> > > === file inc/inc1.php == > <?php > require 'inc2.php'; > ?> > > == file inc/inc2.php == > this is a test > > The above inc/inc1.php is ok for testing.And this would be ok too: > <?php > //file inc/inc1.php > require 'inc/inc2.php'; > ?> > > Problem occurs when the code is like this > <?php > //file inc/inc1.php > require './inc2.php'; > ?> > Fatal error: main(): Failed opening required './inc2.php' > (include_path='.:/usr/local/lib/php') > > It seems that there's no explanation about this in php manual.Could > someone give some? > > Btw,I am using redhat 7.2 / Apache 2.0.47 / PHP 4.3.3RC1 as my testing > server. > Thank you for reading my post:)

« previous php.general (#158789) next »