note 56622 added to function.include
| From: | Arnb at osu1 dot php dot net | Date: | Fri, 09 Sep 2005 15:58:05 +0000 |
| Subject: | note 56622 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-94966@lists.php.net to get a copy of this message | ||
I have my secondary PHP scripts in a Directory named PHP off the main Directory path on my Web
Host's Linux server and was losing my mind getting Include() to to work from the secondary
directory. This solution also preserves the base directory as searchable for Include(). Take a look
at function set_include_path and the user comments for more information.
This code works for me where Foo.php is in http://Someurl.org/PHP/Foo.php
<?php
$path = './PHP/';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
include ('Foo.php');
<?
All dotted and slashed incarnatsion of this with the exception of the full http path, which did not
seem to get my Global Variables, never worked for me
include ('./PHP/Foo.php');
----
Manual Page -- http://www.php.net/manual/en/function.include.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56622
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56622&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56622&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56622&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56622&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56622&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56622&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56622&report=yes
Search -- http://master.php.net/manage/user-notes.php