note 52674 added to function.include

From: Date: Mon, 09 May 2005 15:44:40 +0000
Subject: note 52674 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-89163@lists.php.net to get a copy of this message
A question about include and paths. I'm new to PHP and converting from ASP and IIS to AMP. I'm trying to use the include as such: <?php include ('/topdir/includes/site_settings.inc'); ?> When I do this i get the following error: Warning: main(/topdir/includes/site_settings.inc) [function.main]: failed to open stream: No such file or directory in D:\Personal\CYM\CYMnet\ca\about.php on line 6 When I specify the following it works: <?php include ($_SERVER['DOCUMENT_ROOT'].'/topdir/includes/site_settings.inc'); ?> Is there any way I can avoid using the $SERVER before my path like I can do with IIS and ASP in the form: <!--#INCLUDE VIRTUAL="/CA/includes/site_settings.inc"--> Thanks for your help? ---- Manual Page -- http://www.php.net/manual/en/function.include.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52674 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52674&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52674&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52674&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52674&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52674&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52674&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#89163) next »